make it work... (fix some small issues)

This commit is contained in:
rathnor 2003-07-01 01:49:13 +00:00
parent 17665c37f7
commit 015c61ede0
4 changed files with 16 additions and 7 deletions

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: CommandParser.cc,v 1.1 2003/06/30 14:44:43 fluxgen Exp $ // $Id: CommandParser.cc,v 1.2 2003/07/01 01:49:09 rathnor Exp $
#include "CommandParser.hh" #include "CommandParser.hh"
@ -79,7 +79,7 @@ FbTk::Command *CommandParser::parseLine(const std::string &line) {
command<<"] arguments=["<<arguments<<"]"<<endl; command<<"] arguments=["<<arguments<<"]"<<endl;
#endif // DEBUG #endif // DEBUG
FbTk::StringUtil::toLower(command); command = FbTk::StringUtil::toLower(command);
// we didn't find any matching command in default commands, // we didn't find any matching command in default commands,
// so we search in the command creators modules for a matching command string // so we search in the command creators modules for a matching command string

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: FbCommandFactory.cc,v 1.5 2003/06/30 22:21:33 fluxgen Exp $ // $Id: FbCommandFactory.cc,v 1.6 2003/07/01 01:49:09 rathnor Exp $
#include "FbCommandFactory.hh" #include "FbCommandFactory.hh"
@ -153,10 +153,10 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
else if (command == "prevworkspace" && arguments.size() == 0) else if (command == "prevworkspace" && arguments.size() == 0)
return new PrevWorkspaceCmd(); return new PrevWorkspaceCmd();
else if (command == "workspace") { else if (command == "workspace") {
int num = 0; int num = 1; // workspaces appear 1-indexed to the user
if (!arguments.empty()) if (!arguments.empty())
num = atoi(arguments.c_str()); num = atoi(arguments.c_str());
return new JumpToWorkspaceCmd(num); return new JumpToWorkspaceCmd(num-1);
} else if (command == "nextwindow") } else if (command == "nextwindow")
return new NextWindowCmd(atoi(arguments.c_str())); return new NextWindowCmd(atoi(arguments.c_str()));
else if (command == "prevwindow") else if (command == "prevwindow")

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: StringUtil.cc,v 1.2 2003/06/12 15:14:02 rathnor Exp $ // $Id: StringUtil.cc,v 1.3 2003/07/01 01:49:13 rathnor Exp $
#include "StringUtil.hh" #include "StringUtil.hh"
@ -152,6 +152,13 @@ void toLower(char * const conv) {
conv[byte_pos] = tolower(conv[byte_pos]); conv[byte_pos] = tolower(conv[byte_pos]);
} }
std::string toLower(const std::string &conv) {
char ret_str[conv.size()+1];
::strcpy(ret_str, conv.c_str());
toLower(ret_str);
return ret_str;
}
}; // end namespace StringUtil }; // end namespace StringUtil
}; // end namespace FbTk }; // end namespace FbTk

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
//$Id: StringUtil.hh,v 1.2 2003/06/12 15:14:03 rathnor Exp $ //$Id: StringUtil.hh,v 1.3 2003/07/01 01:49:13 rathnor Exp $
#ifndef FBTK_STRINGUTIL_HH #ifndef FBTK_STRINGUTIL_HH
#define FBTK_STRINGUTIL_HH #define FBTK_STRINGUTIL_HH
@ -46,6 +46,8 @@ int getStringBetween(std::string& out, const char *instr,
/// converts a string to lover case /// converts a string to lover case
void toLower(char * const conv); void toLower(char * const conv);
std::string toLower(const std::string &conv);
/// Breaks a string into tokens /// Breaks a string into tokens
template <typename Container> template <typename Container>