libs/EDoc/StringIdentifiedObject.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003    Copyright (C) 2007 by Brendon Costa
00004 
00005    This library is free software; you can redistribute it and/or modify 
00006    it under the terms of the "LGPL Like" License defined in the file COPYING 
00007    that should have been distributed along with this source.
00008 
00009    This library is distributed in the hope that it will be useful, 
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of 
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013    You should have received a copy of the "LGPL Like" License 
00014    along with this library; see the file COPYING. if not, it can be 
00015    obtained from the EDoc++ website: 
00016    http://edoc.sourceforge.net/license.html
00017 
00018 *******************************************************************************/
00019 #include "config.h"
00020 
00021 #include "EDoc/StringIdentifiedObject.h"
00022 
00023 #include "EDoc/exceptions.h"
00024 
00025 namespace EDoc
00026 {
00027    //===========================================================================
00028    StringIdentifiedObject::StringIdentifiedObject(Dictionary& dict_in,
00029          std::string key_name_in, 
00030          bool populated_in) :
00031 
00032       DictionarySpecific(&dict_in),
00033       populated(populated_in),
00034       index(-1),
00035       key_name(key_name_in),
00036       writing(false)
00037    {
00038    }
00039    //===========================================================================
00040    StringIdentifiedObject::StringIdentifiedObject(Dictionary& dict_in, 
00041          int32_t index_in, 
00042          bool populated_in) :
00043 
00044       DictionarySpecific(&dict_in),
00045       populated(populated_in),
00046       index(index_in),
00047       writing(false)
00048    {
00049    }
00050    //===========================================================================
00051    const std::string& StringIdentifiedObject::GetKeyName() const
00052    {
00053       EDOC_ASSERT(writing || (index == -1), "");
00054       return key_name;
00055    }
00056    //===========================================================================
00057    void StringIdentifiedObject::SetKeyName(std::string key_name_in)
00058    {
00059       // @@@Brendon Only allow if the object was initialised using the index
00060       EDOC_ASSERT(index >= 0, "");
00061       key_name = key_name_in;
00062       index = -1;
00063    }
00064    //===========================================================================
00065 }

Generated on Tue Jan 20 18:26:07 2009 for EDoc-0.2.1 by  doxygen 1.5.1