Add const specifier tu function.

This commit is contained in:
vng 2011-10-05 17:33:02 +03:00 committed by Alex Zolotarev
parent 3ba0b12968
commit 0922eff66c
3 changed files with 5 additions and 3 deletions

View file

@ -479,7 +479,7 @@ void Classificator::SortClassificator()
GetMutableRoot()->Sort();
}
uint32_t Classificator::GetTypeByPath(vector<string> const & path)
uint32_t Classificator::GetTypeByPath(vector<string> const & path) const
{
ClassifObject const * p = GetRoot();

View file

@ -221,7 +221,7 @@ public:
/// Return type by path in classificator tree, example:
/// path = ["natural", "caostline"].
uint32_t GetTypeByPath(vector<string> const & path);
uint32_t GetTypeByPath(vector<string> const & path) const;
uint32_t GetIndexForType(uint32_t t) const { return m_t2i.GetIndex(t); }
uint32_t GetTypeForIndex(uint32_t i) const { return m_i2t.GetType(i); }

View file

@ -36,6 +36,8 @@ size_t CategoriesHolder::LoadFromStream(string const & buffer)
string line;
Category cat;
Classificator const & c = classif();
istringstream stream(buffer);
while (stream.good())
{
@ -56,7 +58,7 @@ size_t CategoriesHolder::LoadFromStream(string const & buffer)
vector<string> v;
strings::Tokenize(*iter, "-", Splitter(v));
// get classificator type
cat.m_types.push_back(classif().GetTypeByPath(v));
cat.m_types.push_back(c.GetTypeByPath(v));
++iter;
}
if (!cat.m_types.empty())