XML writer compiler error

XML writer compiler error

Postby nuclph » Thu Nov 13, 2008 6:53 pm

Hello All,



For Chapter 27: When compiling code for testing XML write and read capabilities:



\xmlwriter.cpp(123) : error C2039: 'accept' : is not a member of 'SimplePropertySet<N,V>'



As I see, SimplePropertySet.hpp does not has function accept but

in the code for XMLWriter.cpp



....



template <class N, class V>

void XMLWriter<N,V>::visit(SimplePropertySet<N, V>& pset)

{



pset.accept(*this);

}

.....





Also, in Entiry.hpp we make forward declaration



template <class Name, class Value>

class EntityThingVisitor; // Forward reference



but we do not have EmtityThingVisitor class, at least not in book CD,

so I changed it to



template <class Name, class Value>

class EntityVisitor; // Forward reference



since we have file EntityVisitor.hpp with EntityVisitor class which looks like:



template <class N, class V> class EntityVisitor

{

public:





// Visit functions.

virtual void visit(Property<N, V>& property) = 0;

virtual void visit(SimplePropertySet<N, V>& pset) = 0;

virtual void visit(Entity<N,V>& entity) = 0;



};







Thank you in advance,



nuclph.
nuclph
 
Posts: 5
Joined: Fri Nov 07, 2008 11:39 pm

Postby Cuchulainn » Thu Nov 20, 2008 4:43 pm

you need to use pset.hpp, cpp in XMLBasicCode directory.



And a new version of MSXML driver (version 6?)



template <class N, class V> class SimplePropertySet

{

private:



N nam; // The name of the set



// The SimplePropertySet list using the STL list

list<Property<N,V> > sl;





public:

// User can use the STL iterator

typedef list<Property<N,V> >::iterator iterator;

typedef list<Property<N,V> >::const_iterator const_iterator;



// Constructors and destructor

SimplePropertySet(); // Default constructor

SimplePropertySet(const N& name); // Named property set

SimplePropertySet(const SimplePropertySet<N,V>& source); // Copy constructor



virtual ~SimplePropertySet(); // Destructor



// Iterator functions

iterator Begin(); // Return iterator at begin of composite

const_iterator Begin() const;// Return const iterator at begin of composite

iterator End(); // Return iterator after end of composite

const_iterator End() const; // Return const iterator after end of composite



// Selectors

int Count() const; // The number of properties in the list

N operator ()() const; // The name of the property set

bool hasPropery(const N& search_name) const; // Is the property in the list?



// Modifiers

void operator () (const N& name); // Change the name of the property set

Property<N,V> value(const N& name) const; // Get the Property based on a name



// Add and remove functions (sort of mixin or embedded inheritance)

void add(const Property<N,V>& p);

void add(const SimplePropertySet<N,V>& p);

void remove(const N& value); // Remove all elements with 'value' O(N)





// Operators

SimplePropertySet<N,V>& operator = (const SimplePropertySet<N,V>& source);





// Visitor

void accept (EntityVisitor<N,V>& vis);



};
User avatar
Cuchulainn
 
Posts: 669
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands


Return to Financial Instrument Pricing using C++ (Duffy)

Who is online

Users browsing this forum: No registered users and 3 guests

cron