00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NCstring_h
00020 #define NCstring_h
00021
00022 #include <iosfwd>
00023
00024 #include <string>
00025
00026 using std::string;
00027 using std::wstring;
00028
00029 using namespace std;
00030
00031 class YCPString;
00032
00033
00035
00036
00037
00038
00039
00040 class NCstring {
00041
00042 friend std::ostream & operator<<( std::ostream & STREAM, const NCstring & OBJ );
00043
00044 private:
00045
00046 mutable wchar_t hotk;
00047 mutable wstring::size_type hotp;
00048 mutable wstring wstr;
00049
00050 static string termEncoding;
00051
00052 public:
00053
00054 NCstring();
00055
00056 NCstring( const NCstring & nstr );
00057
00058 NCstring( const wstring & wstr );
00059
00060 NCstring( const string & str );
00061
00062 NCstring( const char * cstr );
00063
00064 ~NCstring() {}
00065
00066 public:
00067
00068 NCstring( const YCPString & ystr );
00069
00070 NCstring & operator=( const YCPString & ystr );
00071
00072 YCPString YCPstr() const;
00073
00074 string Str() const;
00075
00076 public:
00077
00078 NCstring & operator=( const NCstring & nstr );
00079
00080 NCstring & operator+=( const NCstring & nstr );
00081
00082 const wstring & str() const { return wstr; }
00083
00084 private:
00085
00086 friend class NClabel;
00087 wchar_t hotkey() const { return hotk; }
00088 wstring::size_type hotpos() const { return hotp; }
00089
00090 public:
00091
00092 static bool RecodeToWchar( const string& in, const string & from_encoding, wstring* out );
00093 static bool RecodeFromWchar( const wstring & in, const string & to_encoding, string* out);
00094
00095 static const string & terminalEncoding () {
00096 return termEncoding;
00097 }
00098
00099 static bool setTerminalEncoding( const string & encoding = "" );
00100
00101 void getHotkey() const;
00102 };
00103
00105
00106 #endif // NCstring_h