SLikeNet  0.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
wstring.h
Go to the documentation of this file.
1 /*
2  * Original work: Copyright (c) 2014, Oculus VR, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7  * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8  *
9  *
10  * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt)
11  *
12  * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13  * license found in the license.txt file in the root directory of this source tree.
14  */
15 
16 #ifndef __RAK_W_STRING_H
17 #define __RAK_W_STRING_H
18 
19 #include "Export.h"
20 #include "types.h" // int64_t
21 #include "string.h"
22 
23 #ifdef _WIN32
24 
25 
26 
27 #include "WindowsIncludes.h"
28 #endif
29 
30 namespace SLNet
31 {
34  {
35  public:
36  // Constructors
37  RakWString();
38  RakWString( const RakString &right );
39  RakWString( const wchar_t *input );
40  RakWString( const RakWString & right);
41  RakWString( const char *input );
42  ~RakWString();
43 
45  operator wchar_t* () const {if (c_str) return c_str; return (wchar_t*) L"";}
46 
48  const wchar_t* C_String(void) const {if (c_str) return c_str; return (const wchar_t*) L"";}
49 
51  RakWString& operator = ( const RakWString& right );
52  RakWString& operator = ( const RakString& right );
53  RakWString& operator = ( const wchar_t * const str );
54  RakWString& operator = ( wchar_t *str );
55  RakWString& operator = ( const char * const str );
56  RakWString& operator = ( char *str );
57 
59  RakWString& operator +=( const RakWString& right);
60  RakWString& operator += ( const wchar_t * const right );
61  RakWString& operator += ( wchar_t *right );
62 
64  bool operator==(const RakWString &right) const;
65 
66  // Comparison
67  bool operator < ( const RakWString& right ) const;
68  bool operator <= ( const RakWString& right ) const;
69  bool operator > ( const RakWString& right ) const;
70  bool operator >= ( const RakWString& right ) const;
71 
73  bool operator!=(const RakWString &right) const;
74 
76  void Set( wchar_t *str );
77 
79  bool IsEmpty(void) const;
80 
82  size_t GetLength(void) const;
83 
85  static unsigned long ToInteger(const RakWString &rs);
86 
88  int StrCmp(const RakWString &right) const;
89 
91  int StrICmp(const RakWString &right) const;
92 
94  void Clear(void);
95 
97  void Printf(void);
98 
100  void FPrintf(FILE *fp);
101 
104  void Serialize(BitStream *bs) const;
105 
107  static void Serialize(const wchar_t * const str, BitStream *bs);
108 
112  bool Deserialize(BitStream *bs);
113 
115  static bool Deserialize(wchar_t *str, BitStream *bs);
116  static bool Deserialize(wchar_t *str, size_t strLength, BitStream *bs);
117 
118 
119  protected:
120  wchar_t* c_str;
122  };
123 
124 }
125 
127 
128 
129 #endif