Merge pull request #1 from selurvedu/master

Support symbol strings with '_' in place of '+'
This commit is contained in:
Kristian Setälä 2015-08-02 21:04:24 +03:00
commit 3469f5ce28
3 changed files with 7 additions and 8 deletions

View File

@ -13,7 +13,7 @@ class X11Exception : public std::exception
{ {
public: public:
X11Exception() : _reason("unknown") {} X11Exception() : _reason("unknown") {}
X11Exception(const std::string& what) : _reason(what) {} explicit X11Exception(const std::string& what) : _reason(what) {}
virtual ~X11Exception() throw () {}; virtual ~X11Exception() throw () {};
virtual const char* what() const throw () { return _reason.c_str(); } virtual const char* what() const throw () { return _reason.c_str(); }
@ -21,9 +21,8 @@ private:
std::string _reason; std::string _reason;
}; };
#endif // GAMEEXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F #endif // X11EXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F
// Local Variables: // Local Variables:
// mode: c++ // mode: c++
// End: // End:

View File

@ -124,7 +124,7 @@ Bool XKeyboard::initializeXkb()
groupName = groupNameC; groupName = groupNameC;
std::string::size_type pos = groupName.find('(', 0); std::string::size_type pos = groupName.find('(', 0);
if (pos != std::string::npos) { if (pos != std::string::npos) {
groupName = groupName.substr(0, pos + 1); groupName = groupName.substr(0, pos - 1);
} }
_groupNames.push_back(groupName); _groupNames.push_back(groupName);
} }
@ -327,7 +327,7 @@ void XkbSymbolParser::parse(const std::string& symbols, StringVector& symbolList
for (size_t i = 0; i < symbols.size(); i++) { for (size_t i = 0; i < symbols.size(); i++) {
char ch = symbols[i]; char ch = symbols[i];
if (ch == '+') { if (ch == '+' || ch == '_') {
if (inSymbol) { if (inSymbol) {
if (isXkbLayoutSymbol(curSymbol)) { if (isXkbLayoutSymbol(curSymbol)) {
symbolList.push_back(curSymbol); symbolList.push_back(curSymbol);

View File

@ -59,7 +59,7 @@ bool print_status(XKeyboard& xkb, string format) {
stringstream r; // resulting string stringstream r; // resulting string
for (size_t i = 0; i < format.length(); ++i) { for (size_t i = 0; i < format.length(); ++i) {
if (format[i] == '%' && i < format.length()-1) { if (i < format.length()-2 && format[i] == '%') {
switch (format[i+1]) { switch (format[i+1]) {
case 'c': case 'c':
r << xkb.currentGroupNum(); r << xkb.currentGroupNum();
@ -180,8 +180,8 @@ int main(int argc, char* argv[])
} }
} }
} }
catch (exception e) { catch (const exception *e) {
cerr << e.what() << endl; cerr << e->what() << endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;