diff --git a/src/lib/views/sunlight/vContext.cpp b/src/lib/views/sunlight/vContext.cpp index 81608af..e7e7731 100644 --- a/src/lib/views/sunlight/vContext.cpp +++ b/src/lib/views/sunlight/vContext.cpp @@ -27,18 +27,30 @@ void vContext::vDeleteAllStyles(void) { + /* + * vContext::vDeleteAllStyle() + * Deletes all style entries in this node of the style tree. + */ + + if (styles.empty()) return; + + // create a map<> iterator that points to the beginning style map::iterator curStyle = styles.begin(); + + // loop through the styles, deleting them and calling the style object's + // destructor + while (curStyle != styles.end()) { std::string str = curStyle->first; sStyle * tmpStyle = dynamic_cast(styles[str]); -// if (tmpStyle != NULL) cout << "deleting styles[\"" << str << "\"]" << endl; +// if (tmpStyle != NULL) cout << "deleting styles[\"" << str << "\"]" << endl; styles.erase(curStyle); delete tmpStyle; ++curStyle; - } + } // while return; -} // vContext +} // vContext::vDeleteAllStyles bool vContext::vDeleteStyle(const std::string styleKey) {