From 17dfe176b21fa9dd73194f86554f0fbb9dd4c019 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sat, 2 Jul 2011 10:22:12 +0200 Subject: Remove leftovers from old menus in MenuCreator.* --- src/MenuCreator.cc | 71 ------------------------------------------------------ src/MenuCreator.hh | 21 ---------------- 2 files changed, 92 deletions(-) diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index 70075d1..6a6accc 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc @@ -64,11 +64,6 @@ using std::list; using std::less; using FbTk::AutoReloadHelper; -list MenuCreator::encoding_stack; -list MenuCreator::stacksize_stack; - -FbTk::StringConvertor MenuCreator::m_stringconvertor(FbTk::StringConvertor::ToFbString); - namespace { std::auto_ptr createStyleMenu(int screen_number, const string &label, @@ -542,69 +537,3 @@ bool MenuCreator::createWindowMenuItem(const string &type, return true; } - -/* push our encoding-stacksize onto the stack */ -void MenuCreator::startFile() { - if (encoding_stack.empty()) - m_stringconvertor.setSource(""); - stacksize_stack.push_back(encoding_stack.size()); -} - -/** - * Pop necessary encodings from the stack - * (and endEncoding the final one) to our matching encoding-stacksize. - */ -void MenuCreator::endFile() { - size_t target_size = stacksize_stack.back(); - size_t curr_size = encoding_stack.size(); - - if (target_size != curr_size) { - _FB_USES_NLS; - cerr<<_FB_CONSOLETEXT(Menu, ErrorEndEncoding, "Warning: unbalanced [encoding] tags", "User menu file had unbalanced [encoding] tags")< (target_size+1); --curr_size) - encoding_stack.pop_back(); - - if (curr_size == (target_size+1)) - endEncoding(); - - stacksize_stack.pop_back(); -} - -/** - * Push the encoding onto the stack, and make it active. - */ -void MenuCreator::startEncoding(const string &encoding) { - // we push it regardless of whether it's valid, since we - // need to stay balanced with the endEncodings. - encoding_stack.push_back(encoding); - - // this won't change if it doesn't succeed - m_stringconvertor.setSource(encoding); -} - -/** - * Pop the encoding from the stack, unless we are at our stacksize limit. - * Restore the previous (valid) encoding. - */ -void MenuCreator::endEncoding() { - size_t min_size = stacksize_stack.back(); - if (encoding_stack.size() <= min_size) { - _FB_USES_NLS; - cerr<<_FB_CONSOLETEXT(Menu, ErrorEndEncoding, "Warning: unbalanced [encoding] tags", "User menu file had unbalanced [encoding] tags")<::reverse_iterator it = encoding_stack.rbegin(); - list::reverse_iterator it_end = encoding_stack.rend(); - while (it != it_end && !m_stringconvertor.setSource(*it)) - ++it; - - if (it == it_end) - m_stringconvertor.setSource(""); -} - diff --git a/src/MenuCreator.hh b/src/MenuCreator.hh index 8e5cad1..b2dd7d0 100644 --- a/src/MenuCreator.hh +++ b/src/MenuCreator.hh @@ -51,27 +51,6 @@ public: FbTk::AutoReloadHelper *reloader = NULL); static bool createWindowMenuItem(const std::string &type, const std::string &label, FbTk::Menu &inject_into); - - /** - * Encoding-related helpers (encoding, aka codeset) - */ - - // Files are guaranteed to be "balanced", unlike user-created [encoding] tags. - static void startFile(); - static void endFile(); - - static void startEncoding(const std::string &encoding); - static void endEncoding(); - -private: - // stack of encodings - static std::list encoding_stack; - // stack of ints, representing stack size as each file is entered - // (a file should never end more encodings than it starts) - static std::list stacksize_stack; - - static FbTk::StringConvertor m_stringconvertor; - }; #endif // MENUCREATOR_HH -- cgit v0.11.2