[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [4888] Remove some differences between 'ihs_dbdict.hpp' an
From: |
Greg Chicares |
Subject: |
[lmi-commits] [4888] Remove some differences between 'ihs_dbdict.hpp' and 'dbdict.hpp' |
Date: |
Sat, 01 May 2010 23:11:53 +0000 |
Revision: 4888
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4888
Author: chicares
Date: 2010-05-01 23:11:52 +0000 (Sat, 01 May 2010)
Log Message:
-----------
Remove some differences between 'ihs_dbdict.hpp' and 'dbdict.hpp'
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/database_document.cpp
lmi/trunk/ihs_dbdict.cpp
lmi/trunk/ihs_dbdict.hpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-05-01 18:24:16 UTC (rev 4887)
+++ lmi/trunk/ChangeLog 2010-05-01 23:11:52 UTC (rev 4888)
@@ -25276,3 +25276,18 @@
product_file_test.cpp
Rename 'ihs_funddata.?pp' to 'fund_data.?pp'.
+20100501T1824Z <address@hidden> [732]
+
+ database.cpp
+ database_view_editor.hpp
+ dbdict.cpp
+ dbdict.hpp
+Remove some differences between 'dbdict.hpp' and 'ihs_dbdict.hpp'.
+
+20100501T2311Z <address@hidden> [732]
+
+ database_document.cpp
+ ihs_dbdict.cpp
+ ihs_dbdict.hpp
+Remove some differences between 'ihs_dbdict.hpp' and 'dbdict.hpp'.
+
Modified: lmi/trunk/database_document.cpp
===================================================================
--- lmi/trunk/database_document.cpp 2010-05-01 18:24:16 UTC (rev 4887)
+++ lmi/trunk/database_document.cpp 2010-05-01 23:11:52 UTC (rev 4888)
@@ -81,7 +81,7 @@
// Initialize database dictionary
DBDictionary& instance = DBDictionary::instance();
- swap_workaround_for_singleton workaround(dict_, instance.GetDictionary());
+ swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
instance.InitDB();
}
@@ -104,7 +104,7 @@
{
DBDictionary& instance = DBDictionary::instance();
- swap_workaround_for_singleton workaround(dict_, instance.GetDictionary());
+ swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
DBDictionary::InvalidateCache();
instance.Init(filename);
@@ -114,7 +114,7 @@
{
DBDictionary& instance = DBDictionary::instance();
- swap_workaround_for_singleton workaround(dict_, instance.GetDictionary());
+ swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
instance.WriteDB(filename);
}
Modified: lmi/trunk/ihs_dbdict.cpp
===================================================================
--- lmi/trunk/ihs_dbdict.cpp 2010-05-01 18:24:16 UTC (rev 4887)
+++ lmi/trunk/ihs_dbdict.cpp 2010-05-01 23:11:52 UTC (rev 4888)
@@ -1,4 +1,4 @@
-// Product database.
+// Product-database map.
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010 Gregory W. Chicares.
//
@@ -157,15 +157,15 @@
xml_lmi::dom_parser parser(NewFilename);
xml::element const& root = parser.root_node(xml_root_name());
- xml_serialize::from_xml(root, dictionary);
+ xml_serialize::from_xml(root, dictionary_);
- if(NumberOfEntries != static_cast<int>(dictionary.size()))
+ if(NumberOfEntries != static_cast<int>(dictionary_.size()))
{
std::ostringstream oss;
oss
<< "is not up to date or is corrupted."
<< " It should contain " << NumberOfEntries
- << " elements, but it actually contains " << dictionary.size()
+ << " elements, but it actually contains " << dictionary_.size()
<< " elements."
;
BadFile(NewFilename, oss.str());
@@ -202,17 +202,17 @@
//============================================================================
void DBDictionary::WriteDB(std::string const& filename)
{
- if(NumberOfEntries != static_cast<int>(dictionary.size()))
+ if(NumberOfEntries != static_cast<int>(dictionary_.size()))
{
fatal_error()
<< "Error writing database '"
<< filename
- << "': the database has " << dictionary.size()
+ << "': the database has " << dictionary_.size()
<< " entries, but should have " << NumberOfEntries << '.'
;
for(int j = 0; j < NumberOfEntries; j++)
{
- if(!dictionary.count(j))
+ if(!dictionary_.count(j))
{
fatal_error() << " Key " << j << " not found.";
}
@@ -224,7 +224,7 @@
xml::element& root = document.root_node();
xml_lmi::set_attr(root, "version", "0");
- xml_serialize::to_xml(root, dictionary);
+ xml_serialize::to_xml(root, dictionary_);
// Instead of this:
// document.save(filename);
@@ -238,8 +238,8 @@
//===========================================================================
void DBDictionary::Add(TDBValue const& e)
{
- dictionary.erase(e.GetKey());
- dictionary.insert(dict_map_val(e.GetKey(), e));
+ dictionary_.erase(e.GetKey());
+ dictionary_.insert(dict_map_val(e.GetKey(), e));
}
//============================================================================
@@ -248,7 +248,7 @@
{
static double const bignum = std::numeric_limits<double>::max();
- dictionary.erase(dictionary.begin(), dictionary.end());
+ dictionary_.clear();
for(int j = DB_FIRST; j < DB_LAST; ++j)
{
Add(TDBValue(j, 0.0));
@@ -691,12 +691,13 @@
DBDictionary::instance().Init(i->string());
fs::path out_file = fs::change_extension(*i, ".dbt");
fs::ofstream os(out_file, ios_out_trunc_binary());
- dict_map& dictionary = DBDictionary::instance().GetDictionary();
+ dict_map const& dictionary = DBDictionary::instance().GetDictionary();
// std::ostream_iterator not used because it doesn't work
// nicely with std::map (a name-lookup issue).
- for(unsigned int j = 0; j < dictionary.size(); j++)
+ typedef dict_map::const_iterator dmci;
+ for(dmci i = dictionary.begin(); i != dictionary.end(); ++i)
{
- dictionary[j].write(os);
+ i->second.write(os);
}
}
}
Modified: lmi/trunk/ihs_dbdict.hpp
===================================================================
--- lmi/trunk/ihs_dbdict.hpp 2010-05-01 18:24:16 UTC (rev 4887)
+++ lmi/trunk/ihs_dbdict.hpp 2010-05-01 23:11:52 UTC (rev 4888)
@@ -1,4 +1,4 @@
-// Database map.
+// Product-database map.
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008,
2009, 2010 Gregory W. Chicares.
//
@@ -53,7 +53,7 @@
static DBDictionary& instance();
~DBDictionary();
void Init(std::string const& NewFilename);
- dict_map& GetDictionary();
+ dict_map const& GetDictionary() const;
void WriteSampleDBFile();
void WriteProprietaryDBFiles();
@@ -68,11 +68,11 @@
static void InvalidateCache();
static std::string CachedFilename;
- dict_map dictionary;
+ dict_map dictionary_;
};
-inline dict_map& DBDictionary::GetDictionary()
-{return dictionary;}
+inline dict_map const& DBDictionary::GetDictionary() const
+{return dictionary_;}
void LMI_SO print_databases();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [4888] Remove some differences between 'ihs_dbdict.hpp' and 'dbdict.hpp',
Greg Chicares <=