all repos — fluxbox @ 39224b0142078376d2bd39789b4de24a18377cf0

custom fork of the fluxbox windowmanager

move Parser to FbTk
Mark Tiefenbruck mark@fluxbox.org
commit

39224b0142078376d2bd39789b4de24a18377cf0

parent

e8a2f155e8d5a082a8c04f291e65c137c20a05cb

M src/FbMenuParser.ccsrc/FbMenuParser.cc

@@ -34,9 +34,9 @@ m_curr_token = DONE;

return isLoaded(); } -Parser &FbMenuParser::operator >> (Parser::Item &out) { +FbTk::Parser &FbMenuParser::operator >> (FbTk::Parser::Item &out) { if (eof()) { - out = Parser::s_empty_item; + out = FbTk::Parser::s_empty_item; return *this; }

@@ -65,7 +65,7 @@ second = '>';

break; case DONE: // get new line and call this again if (!nextLine()) { - out = Parser::s_empty_item; + out = FbTk::Parser::s_empty_item; return *this; } return (*this)>>out;

@@ -86,7 +86,7 @@ m_curr_token = ICON;

else if (m_curr_token == ICON) m_curr_token = DONE; - out = Parser::s_empty_item; + out = FbTk::Parser::s_empty_item; return *this; }

@@ -119,8 +119,8 @@ }

return *this; } -Parser::Item FbMenuParser::nextItem() { - Parser::Item item; +FbTk::Parser::Item FbMenuParser::nextItem() { + FbTk::Parser::Item item; (*this)>>item; return item; }
M src/FbMenuParser.hhsrc/FbMenuParser.hh

@@ -25,11 +25,11 @@

#ifndef FBMENUPARSER_HH #define FBMENUPARSER_HH -#include "Parser.hh" +#include "FbTk/Parser.hh" #include <fstream> -class FbMenuParser: public Parser { +class FbMenuParser: public FbTk::Parser { public: FbMenuParser():m_row(0), m_curr_pos(0), m_curr_token(TYPE) {} FbMenuParser(const std::string &filename):m_row(0), m_curr_pos(0),

@@ -38,8 +38,8 @@ ~FbMenuParser() { close(); }

bool open(const std::string &filename); void close() { m_file.close(); } - Parser &operator >> (Parser::Item &out); - Parser::Item nextItem(); + FbTk::Parser &operator >> (FbTk::Parser::Item &out); + FbTk::Parser::Item nextItem(); bool isLoaded() const { return m_file.is_open(); } bool eof() const { return m_file.eof(); }
M src/FbTk/Makefile.amsrc/FbTk/Makefile.am

@@ -40,7 +40,7 @@ Container.hh Container.cc \

Layer.hh LayerItem.hh MultLayers.cc MultLayers.hh \ XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \ Resource.hh Resource.cc \ - StringUtil.hh StringUtil.cc \ + StringUtil.hh StringUtil.cc Parser.hh Parser.cc \ FbString.hh FbString.cc \ Subject.hh Subject.cc Observer.hh Observer.cc \ Transparent.hh Transparent.cc \
M src/Makefile.amsrc/Makefile.am

@@ -122,7 +122,7 @@ MenuTheme.hh MenuTheme.cc \

CommandDialog.hh CommandDialog.cc SendToMenu.hh SendToMenu.cc \ AlphaMenu.hh AlphaMenu.cc ObjectResource.hh \ CompareWindow.hh \ - Parser.hh Parser.cc FbMenuParser.hh FbMenuParser.cc \ + FbMenuParser.hh FbMenuParser.cc \ StyleMenuItem.hh StyleMenuItem.cc \ RootCmdMenuItem.hh RootCmdMenuItem.cc\ MenuCreator.hh MenuCreator.cc \
M src/MenuCreator.ccsrc/MenuCreator.cc

@@ -143,7 +143,7 @@ class ParseItem {

public: explicit ParseItem(FbTk::Menu *menu):m_menu(menu) {} - inline void load(Parser &p, FbTk::StringConvertor &m_labelconvertor) { + inline void load(FbTk::Parser &p, FbTk::StringConvertor &m_labelconvertor) { p>>m_key>>m_label>>m_cmd>>m_icon; m_label.second = m_labelconvertor.recode(m_label.second); }

@@ -153,7 +153,7 @@ inline const string &label() const { return m_label.second; }

inline const string &key() const { return m_key.second; } inline FbTk::Menu *menu() { return m_menu; } private: - Parser::Item m_key, m_label, m_cmd, m_icon; + FbTk::Parser::Item m_key, m_label, m_cmd, m_icon; FbTk::Menu *m_menu; };

@@ -172,10 +172,10 @@ }

}; -static void translateMenuItem(Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor); +static void translateMenuItem(FbTk::Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor); -static void parseMenu(Parser &pars, FbTk::Menu &menu, FbTk::StringConvertor &label_convertor) { +static void parseMenu(FbTk::Parser &pars, FbTk::Menu &menu, FbTk::StringConvertor &label_convertor) { ParseItem pitem(&menu); while (!pars.eof()) { pitem.load(pars, label_convertor);

@@ -185,7 +185,7 @@ translateMenuItem(pars, pitem, label_convertor);

} } -static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConvertor &labelconvertor) { +static void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::StringConvertor &labelconvertor) { if (pitem.menu() == 0) throw string("translateMenuItem: We must have a menu in ParseItem!");

@@ -315,8 +315,8 @@ MenuCreator::startEncoding(str_cmd);

} else if (str_key == "endencoding") { MenuCreator::endEncoding(); } - else { // ok, if we didn't find any special menu item we try with command parser - // we need to attach command with arguments so command parser can parse it + else { // ok, if we didn't find any special menu item we try with command FbTk::Parser + // we need to attach command with arguments so command FbTk::Parser can parse it string line = str_key + " " + str_cmd; FbTk::RefCount<FbTk::Command> command(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(line)); if (*command != 0) {

@@ -341,7 +341,7 @@ }

} -static void parseWindowMenu(Parser &parse, FbTk::Menu &menu, FbTk::StringConvertor &labelconvertor) { +static void parseWindowMenu(FbTk::Parser &parse, FbTk::Menu &menu, FbTk::StringConvertor &labelconvertor) { ParseItem pitem(&menu); while (!parse.eof()) {
M src/Parser.ccsrc/FbTk/Parser.cc

@@ -1,4 +1,4 @@

-// Parser.cc +// Parser.cc for FbTk // Copyright (c) 2004 - 2006 Fluxbox Team (fluxgen at fluxbox dot org) // // Permission is hereby granted, free of charge, to any person obtaining a

@@ -19,8 +19,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id$ - #include "Parser.hh" -const Parser::Item Parser::s_empty_item("", ""); +namespace FbTk { + const Parser::Item Parser::s_empty_item("", ""); +};
M src/Parser.hhsrc/FbTk/Parser.hh

@@ -1,4 +1,4 @@

-// IconMenuItem.hh for Fluxbox Window Manager +// Parser.hh for FbTk // Copyright (c) 2004 Henrik Kinnunen (fluxgen at fluxbox dot org) // and Simon Bowden (rathnor at users.sourceforge.net) //

@@ -20,13 +20,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id$ - -#ifndef PARSER_HH -#define PARSER_HH +#ifndef FBTK_PARSER_HH +#define FBTK_PARSER_HH #include <string> #include <utility> + +namespace FbTk { // interface class for a generic Parser class Parser {

@@ -47,5 +47,6 @@ virtual Item nextItem() = 0;

}; +}; // end namespace FbTk -#endif // PARSER_HH +#endif // FBTK_PARSER_HH