]> git.mxchange.org Git - simgear.git/blob - simgear/nasal/cppbind/NasalString.hxx
cppbind.Ghost: clean up a bit
[simgear.git] / simgear / nasal / cppbind / NasalString.hxx
1 ///@file Wrapper class for Nasal strings
2 //
3 // Copyright (C) 2013  Thomas Geymayer <tomgey@gmail.com>
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Library General Public
7 // License as published by the Free Software Foundation; either
8 // version 2 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // Library General Public License for more details.
14 //
15 // You should have received a copy of the GNU Library General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
18
19 #ifndef SG_NASAL_STRING_HXX_
20 #define SG_NASAL_STRING_HXX_
21
22 #include "from_nasal.hxx"
23 #include "to_nasal.hxx"
24
25 namespace nasal
26 {
27
28   /**
29    * A Nasal String
30    */
31   class String
32   {
33     public:
34
35       static const size_t npos;
36
37       /**
38        * Create a new Nasal String
39        *
40        * @param c   Nasal context for creating the string
41        * @param str String data
42        */
43       String(naContext c, const char* str);
44
45       /**
46        * Initialize from an existing Nasal String
47        *
48        * @param str   Existing Nasal String
49        */
50       String(naRef string);
51
52       const char* c_str() const;
53       const char* begin() const;
54       const char* end() const;
55
56       size_t size() const;
57       size_t length() const;
58       bool empty() const;
59
60       int compare(size_t pos, size_t len, const String& rhs) const;
61       bool starts_with(const String& rhs) const;
62       bool ends_with(const String& rhs) const;
63
64       size_t find(const char c, size_t pos = 0) const;
65       size_t find_first_of(const String& chr, size_t pos = 0) const;
66       size_t find_first_not_of(const String& chr, size_t pos = 0) const;
67
68       /**
69        * Get Nasal representation of String
70        */
71       const naRef get_naRef() const;
72
73     protected:
74
75       naRef _str;
76
77   };
78
79 } // namespace nasal
80
81 #endif /* SG_NASAL_STRING_HXX_ */