Chris,
Could you please add this patch. It fixes some potential namespace collisions
in the templates in anticipation of refactoring the records classes.
Thanks,
-edge
P.S. For anyone who cares and to save someone else work:I have Messages, PIN
Messages and Saved Email Messages finished but I'll send the patches after
the refactoring is finished.
Index: src/record.cc
===================================================================
RCS file: /cvsroot/barry/barry/src/record.cc,v
retrieving revision 1.24
diff -u -r1.24 record.cc
--- src/record.cc 24 May 2007 19:21:39 -0000 1.24
+++ src/record.cc 25 May 2007 01:04:25 -0000
@@ -47,8 +47,8 @@
-template <class Record>
-const unsigned char* ParseCommonFields(Record &rec, const void *begin, const void *end)
+template <class RecordT>
+const unsigned char* ParseCommonFields(RecordT &rec, const void *begin, const void *end)
{
const unsigned char *b = (const unsigned char*) begin;
const unsigned char *e = (const unsigned char*) end;
@@ -527,16 +527,16 @@
#define CFC_INVALID_FIELD 255
// Contact code to field table
-template <class Record>
+template <class RecordT>
struct FieldLink
{
int type;
char *name;
char *ldif;
char *objectClass;
- std::string Record::* strMember; // FIXME - find a more general
- Message::Address Record::* addrMember; // way to do this...
- time_t Record::* timeMember;
+ std::string RecordT::* strMember; // FIXME - find a more general
+ Message::Address RecordT::* addrMember; // way to do this...
+ time_t RecordT::* timeMember;
};
FieldLink<Contact> ContactFieldLinks[] = {
Index: src/parser.h
===================================================================
RCS file: /cvsroot/barry/barry/src/parser.h,v
retrieving revision 1.9
diff -u -r1.9 parser.h
--- src/parser.h 26 Jan 2007 04:10:32 -0000 1.9
+++ src/parser.h 25 May 2007 01:04:25 -0000
@@ -106,12 +106,12 @@
/// con.LoadDatabase(con.GetDBID("Address Book"), parser);
/// </pre>
///
-template <class Record, class Storage>
+template <class RecordT, class Storage>
class RecordParser : public Parser
{
Storage *m_store;
bool m_owned;
- Record m_rec;
+ RecordT m_rec;
public:
/// Constructor that references an externally managed storage object.
@@ -133,7 +133,7 @@
virtual void Clear()
{
- m_rec = Record();
+ m_rec = RecordT();
}
virtual void SetIds(uint8_t RecType, uint32_t UniqueId)
Index: src/builder.h
===================================================================
RCS file: /cvsroot/barry/barry/src/builder.h,v
retrieving revision 1.6
diff -u -r1.6 builder.h
--- src/builder.h 26 Jan 2007 04:10:31 -0000 1.6
+++ src/builder.h 25 May 2007 01:04:25 -0000
@@ -85,12 +85,12 @@
/// FIXME
/// </pre>
///
-template <class Record, class Storage>
+template <class RecordT, class Storage>
class RecordBuilder : public Builder
{
Storage *m_storage;
bool m_owned;
- Record m_rec;
+ RecordT m_rec;
public:
/// Constructor that references an externally managed storage object.
Index: tools/upldif.cc
===================================================================
RCS file: /cvsroot/barry/barry/tools/upldif.cc,v
retrieving revision 1.5
diff -u -r1.5 upldif.cc
--- tools/upldif.cc 23 Feb 2007 05:39:42 -0000 1.5
+++ tools/upldif.cc 25 May 2007 01:04:25 -0000
@@ -44,11 +44,11 @@
<< endl;
}
-template <class Record>
+template <class RecordT>
struct Store
{
- std::vector<Record> records;
- mutable typename std::vector<Record>::const_iterator rec_it;
+ std::vector<RecordT> records;
+ mutable typename std::vector<RecordT>::const_iterator rec_it;
int count;
Barry::ContactLdif ldif;
@@ -59,7 +59,7 @@
: count(0),
ldif("")
{
- Record rec;
+ RecordT rec;
while( is ) {
if( ldif.ReadLdif(is, rec) ) {
count++;
@@ -77,7 +77,7 @@
// Retrieval operator -- called by Barry during the upload
// process to get the next object
- bool operator()(Record &rec, unsigned int databaseId) const
+ bool operator()(RecordT &rec, unsigned int databaseId) const
{
if( rec_it == records.end() )
return false;
@@ -89,15 +89,15 @@
// For easy data display and debugging.
void Dump(std::ostream &os) const
{
- typename std::vector<Record>::const_iterator b = records.begin();
+ typename std::vector<RecordT>::const_iterator b = records.begin();
for( ; b != records.end(); ++b ) {
os << *b << endl;
}
}
};
-template <class Record>
-std::ostream& operator<< (std::ostream &os, const Store<Record> &store)
+template <class RecordT>
+std::ostream& operator<< (std::ostream &os, const Store<RecordT> &store)
{
store.Dump(os);
return os;
Index: tools/btool.cc
===================================================================
RCS file: /cvsroot/barry/barry/tools/btool.cc,v
retrieving revision 1.14
diff -u -r1.14 btool.cc
--- tools/btool.cc 24 Feb 2007 04:48:05 -0000 1.14
+++ tools/btool.cc 25 May 2007 01:04:25 -0000
@@ -91,11 +91,11 @@
}
};
-template <class Record>
+template <class RecordT>
struct Store
{
- std::vector<Record> records;
- mutable typename std::vector<Record>::const_iterator rec_it;
+ std::vector<RecordT> records;
+ mutable typename std::vector<RecordT>::const_iterator rec_it;
std::string filename;
bool load;
int count;
@@ -122,7 +122,7 @@
rec_it = records.begin();
// debugging aid
- typename std::vector<Record>::const_iterator beg = records.begin(), end = records.end();
+ typename std::vector<RecordT>::const_iterator beg = records.begin(), end = records.end();
for( ; beg != end; beg++ ) {
cout << (*beg) << endl;
}
@@ -143,7 +143,7 @@
if( !load && filename.size() ) {
// filename is available, attempt to save
cout << "Saving: " << filename << endl;
- const std::vector<Record> &r = records;
+ const std::vector<RecordT> &r = records;
ofstream ofs(filename.c_str());
boost::archive::text_oarchive oa(ofs);
oa << r;
@@ -159,7 +159,7 @@
}
// storage operator
- void operator()(const Record &rec)
+ void operator()(const RecordT &rec)
{
count++;
std::cout << rec << std::endl;
@@ -167,7 +167,7 @@
}
// retrieval operator
- bool operator()(Record &rec, unsigned int databaseId) const
+ bool operator()(RecordT &rec, unsigned int databaseId) const
{
if( rec_it == records.end() )
return false;
@@ -540,13 +540,13 @@
unsigned int id = con.GetDBID(*b);
RecordStateTable state;
con.GetRecordStateTable(id, state);
- cout << "Record state table for: " << *b << endl;
+ cout << "RecordT state table for: " << *b << endl;
cout << state;
}
return 0;
}
- // Get Record mode overrides the default name mode
+ // Get RecordT mode overrides the default name mode
if( stCommands.size() ) {
if( dbNames.size() != 1 ) {
cout << "Must have 1 db name to process" << endl;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel