diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-08 22:26:17 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-08 22:49:18 +0900 |
commit | 2fe8b1b92fa2a9b93fea0ed0cb62802237b82e8d (patch) | |
tree | 50b6e05734cd5c0f642eeac4e841539db25f113b /arts/modules/common/env_container_impl.cc | |
parent | 6f9d8ae25c3ff607e0e07315884c967dd0bca901 (diff) | |
download | tdemultimedia-2fe8b1b92fa2a9b93fea0ed0cb62802237b82e8d.tar.gz tdemultimedia-2fe8b1b92fa2a9b93fea0ed0cb62802237b82e8d.zip |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit fce86b22a2367f1be1f9aae5e1ba3d18d1371b74)
Diffstat (limited to 'arts/modules/common/env_container_impl.cc')
-rw-r--r-- | arts/modules/common/env_container_impl.cc | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/arts/modules/common/env_container_impl.cc b/arts/modules/common/env_container_impl.cc deleted file mode 100644 index 0a6f87d7..00000000 --- a/arts/modules/common/env_container_impl.cc +++ /dev/null @@ -1,136 +0,0 @@ -#include "artsmodulescommon.h" -#include "../runtime/sequenceutils.h" -#include <debug.h> - -using namespace std; - -namespace Arts { -namespace Environment { - -class Container_impl : virtual public Container_skel { -protected: - string _dataDirectory; - Context _context; - vector<Item> _items; - - Container self() { return Container::_from_base(_copy()); } -public: - ~Container_impl() - { - // tell items we're going to leave before actually going away - clear(); - } - string dataDirectory() - { - return _dataDirectory; - } - void dataDirectory(const string& newDataDirectory) - { - if(newDataDirectory != _dataDirectory) - { - _dataDirectory = newDataDirectory; - dataDirectory_changed(newDataDirectory); - } - } - Context context() - { - return _context; - } - void context(Context newContext) - { - _context = newContext; - } - vector<Item> *items() - { - return new vector<Item>(_items); - } - vector<string> *saveToList() - { - vector<string> *result = new vector<string>; - - vector<Item>::iterator ii; - for(ii=_items.begin(); ii != _items.end(); ii++) - { - sqprintf(result,"item=%s",ii->_interfaceName().c_str()); - - vector<string> *itemresult = ii->saveToList(); - addSubStringSeq(result,itemresult); - delete itemresult; - } - return result; - } - - void clear() - { - /* FIXME: performance ;) */ - while(!_items.empty()) - removeItem(_items.front()); - } - - void loadFromList(const vector<string>& strlist) - { - string cmd,param; - unsigned long i; - - clear(); - - for(i=0;i<strlist.size();i++) - { - if(parse_line(strlist[i],cmd,param)) // otherwise: empty or comment - { - if(cmd == "item") - { - Item item = createItem(param); - vector<string> *itemlist = getSubStringSeq(&strlist,i); - - if(!item.isNull()) - item.loadFromList(*itemlist); - else - { - // error handling - assert(false); - } - delete itemlist; - } - } - } - } - - vector<Item>::iterator findItem(Item item) - { - vector<Item>::iterator i; - for(i = _items.begin(); i != _items.end(); i++) - if(i->_isEqual(item)) return i; - - return _items.end(); - } - - void addItem(Item item) - { - vector<Item>::iterator i = findItem(item); - arts_return_if_fail(i == _items.end()); - - _items.push_back(item); - item.setContainer(self()); - } - - Item createItem(const string& name) - { - Item item = SubClass(name); - addItem(item); - return item; - } - - void removeItem(Item item) - { - vector<Item>::iterator i = findItem(item); - arts_return_if_fail(i != _items.end()); - - _items.erase(i); - item.setContainer(Container::null()); - } -}; -REGISTER_IMPLEMENTATION(Container_impl); -} -} - |