libyui-ncurses
 
Loading...
Searching...
No Matches
NCstring.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: NCstring.h
20
21 Author: Michael Andres <ma@suse.de>
22
23/-*/
24
25#ifndef NCstring_h
26#define NCstring_h
27
28#include <iosfwd>
29#include <string>
30
31
35class NCstring
36{
37private:
38
39 friend std::ostream & operator<<( std::ostream & str, const NCstring & obj );
40
41 mutable wchar_t hotk;
47 mutable std::wstring::size_type hotp;
48 mutable std::wstring wstr;
49
53 static std::string termEncoding;
54
55public:
56
57 NCstring();
58
59 NCstring( const NCstring & nstr );
60
61 NCstring( const std::wstring & wstr );
62
64 NCstring( const std::string & str );
65
67 NCstring( const char * cstr );
68
69 ~NCstring() {}
70
72 std::string Str() const;
73
74public:
75
76 NCstring & operator=( const NCstring & nstr );
77
78 NCstring & operator+=( const NCstring & nstr );
79
80 const std::wstring & str() const { return wstr; }
81
82private:
83
84 friend class NClabel;
85
86 wchar_t hotkey() const { return hotk; }
87 std::wstring::size_type hotpos() const { return hotp; }
88
89public:
90
91 static bool RecodeToWchar ( const std::string & in, const std::string & from_encoding, std::wstring * out );
92 static bool RecodeFromWchar( const std::wstring & in, const std::string & to_encoding, std::string * out );
93
94 static const std::string & terminalEncoding()
95 {
96 return termEncoding;
97 }
98
99 static bool setTerminalEncoding( const std::string & encoding = "" );
100
102 void getHotkey() const;
103};
104
105
106#endif // NCstring_h
std::string Str() const
Get a UTF-8 string.
Definition NCstring.cc:301
void getHotkey() const
(mutates the const object)
Definition NCstring.cc:311