diff options
author | mathias <mathias> | 2005-02-10 10:24:31 (GMT) |
---|---|---|
committer | mathias <mathias> | 2005-02-10 10:24:31 (GMT) |
commit | 4a7d0b8434e20d306a670d87cdec8cfe6fd308c5 (patch) | |
tree | 3bfd6806cb7b1937dc9cbf8aeff116d80476bfb2 /src/CommandParser.cc | |
parent | 6e15a329736306595b9611087fced2650adda5c4 (diff) | |
download | fluxbox-4a7d0b8434e20d306a670d87cdec8cfe6fd308c5.zip fluxbox-4a7d0b8434e20d306a670d87cdec8cfe6fd308c5.tar.bz2 |
cosmetic + updated copyright year
Diffstat (limited to 'src/CommandParser.cc')
-rw-r--r-- | src/CommandParser.cc | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/CommandParser.cc b/src/CommandParser.cc index 582fa44..d4c6a28 100644 --- a/src/CommandParser.cc +++ b/src/CommandParser.cc | |||
@@ -23,22 +23,14 @@ | |||
23 | // $Id$ | 23 | // $Id$ |
24 | 24 | ||
25 | #include "CommandParser.hh" | 25 | #include "CommandParser.hh" |
26 | 26 | #include "FbTk/StringUtil.hh" | |
27 | #include "StringUtil.hh" | ||
28 | 27 | ||
29 | #include <vector> | 28 | #include <vector> |
30 | using namespace std; | ||
31 | |||
32 | namespace { | ||
33 | |||
34 | string::size_type removeFirstWhitespace(std::string &str) { | ||
35 | string::size_type first_pos = str.find_first_not_of(" \t"); | ||
36 | if (first_pos != string::npos) | ||
37 | str.erase(0, first_pos); | ||
38 | return first_pos; | ||
39 | } | ||
40 | 29 | ||
41 | }; // end anonymous namespace | 30 | using std::string; |
31 | using std::vector; | ||
32 | using FbTk::StringUtil::removeFirstWhitespace; | ||
33 | using FbTk::StringUtil::toLower; | ||
42 | 34 | ||
43 | CommandFactory::CommandFactory() { | 35 | CommandFactory::CommandFactory() { |
44 | 36 | ||
@@ -49,7 +41,7 @@ CommandFactory::~CommandFactory() { | |||
49 | CommandParser::instance().removeAssociation(*this); | 41 | CommandParser::instance().removeAssociation(*this); |
50 | } | 42 | } |
51 | 43 | ||
52 | void CommandFactory::addCommand(const std::string &command_name) { | 44 | void CommandFactory::addCommand(const string &command_name) { |
53 | CommandParser::instance().associateCommand(command_name, *this); | 45 | CommandParser::instance().associateCommand(command_name, *this); |
54 | } | 46 | } |
55 | 47 | ||
@@ -58,7 +50,7 @@ CommandParser &CommandParser::instance() { | |||
58 | return singleton; | 50 | return singleton; |
59 | } | 51 | } |
60 | 52 | ||
61 | FbTk::Command *CommandParser::parseLine(const std::string &line) { | 53 | FbTk::Command *CommandParser::parseLine(const string &line) { |
62 | 54 | ||
63 | // parse arguments and command | 55 | // parse arguments and command |
64 | string command = line; | 56 | string command = line; |
@@ -74,7 +66,7 @@ FbTk::Command *CommandParser::parseLine(const std::string &line) { | |||
74 | 66 | ||
75 | // now we have parsed command and arguments | 67 | // now we have parsed command and arguments |
76 | 68 | ||
77 | command = FbTk::StringUtil::toLower(command); | 69 | command = toLower(command); |
78 | 70 | ||
79 | // we didn't find any matching command in default commands, | 71 | // we didn't find any matching command in default commands, |
80 | // so we search in the command creators modules for a | 72 | // so we search in the command creators modules for a |
@@ -100,7 +92,7 @@ void CommandParser::associateCommand(const std::string &command, CommandFactory | |||
100 | 92 | ||
101 | void CommandParser::removeAssociation(CommandFactory &factory) { | 93 | void CommandParser::removeAssociation(CommandFactory &factory) { |
102 | // commands that are associated with the factory | 94 | // commands that are associated with the factory |
103 | std::vector<std::string> commands; | 95 | vector<string> commands; |
104 | // find associations | 96 | // find associations |
105 | CommandFactoryMap::iterator factory_it = m_commandfactorys.begin(); | 97 | CommandFactoryMap::iterator factory_it = m_commandfactorys.begin(); |
106 | const CommandFactoryMap::iterator factory_it_end = m_commandfactorys.end(); | 98 | const CommandFactoryMap::iterator factory_it_end = m_commandfactorys.end(); |