CSailDoc Class Reference
[File input and output]

#include <saildoc.h>

List of all members.

Public Member Functions

 CSailDoc ()
 CSailDoc (const QString &filename)
QDomElement createElement (const QString &type)
QDomElement createElement (const QString &type, const QString &name)
QDomElement createElement (const QString &type, const QString &name, const QString &value)
QDomElement findElement (const QDomNode &parent, const QString &type, const QString &name)
void get (const QDomNode &parent, int &i, const QString &name)
void get (const QDomNode &parent, unsigned int &i, const QString &name)
void get (const QDomNode &parent, real &r, const QString &name)
void get (const QDomNode &parent, string &s, const QString &name)
void get (const QDomNode &parent, QString &s, const QString &name)
void get (const QDomNode &parent, CPoint3d &p, const QString &name)
void get (const QDomNode &parent, enumBoatElementType &t, const QString &name)
void get (const QDomNode &parent, enumPanelGroupType &t, const QString &name)
void get (const QDomNode &parent, enumSailCut &c, const QString &name)
void get (const QDomNode &parent, enumSailType &t, const QString &name)
void get (const QDomNode &parent, CHullDef &d, const QString &name)
void get (const QDomNode &parent, CSailDef &d, const QString &name)
void get (const QDomNode &parent, CSide &s, const QString &name)
void get (const QDomNode &parent, CPanel &p, const QString &name)
void get (const QDomNode &parent, CBoatDef &d, const QString &name)
void get (const QDomNode &parent, CBoatElement &s, const QString &name)
void get (const QDomNode &parent, CPanelGroup &g, const QString &name)
void get (const QDomNode &parent, CProfile &p, const QString &name)
void get (const QDomNode &parent, CSailMould &m, const QString &name)
void get (const QDomNode &parent, CPrefs &p, const QString &name)
void get (const QDomNode &parent, CRigDef &d, const QString &name)
void put (QDomNode &parent, const int &i, const QString &name="")
void put (QDomNode &parent, const unsigned int &i, const QString &name="")
void put (QDomNode &parent, const real &r, const QString &name="")
void put (QDomNode &parent, const string &s, const QString &name="")
void put (QDomNode &parent, const QString &s, const QString &name="")
void put (QDomNode &parent, const CPoint3d &p, const QString &name="")
void put (QDomNode &parent, const enumBoatElementType &t, const QString &name="")
void put (QDomNode &parent, const enumPanelGroupType &t, const QString &name="")
void put (QDomNode &parent, const enumSailCut &c, const QString &name="")
void put (QDomNode &parent, const enumSailType &t, const QString &name="")
void put (QDomNode &parent, const CBoatDef &d, const QString &name="")
void put (QDomNode &parent, const CBoatElement &s, const QString &name="")
void put (QDomNode &parent, const CHullDef &d, const QString &name="")
void put (QDomNode &parent, const CSailDef &d, const QString &name="")
void put (QDomNode &parent, const CSide &s, const QString &name="")
void put (QDomNode &parent, const CPanel &p, const QString &name="")
void put (QDomNode &parent, const CPanelGroup &g, const QString &name="")
void put (QDomNode &parent, const CProfile &p, const QString &name="")
void put (QDomNode &parent, const CSailMould &m, const QString &name="")
void put (QDomNode &parent, const CPrefs &p, const QString &name="")
void put (QDomNode &parent, const CRigDef &d, const QString &name="")
void toFile (const QString &filename)

Public Attributes

QDomElement top

Protected Member Functions

template<class myType>
void get_vector (QDomNode &parent, vector< myType > &v, const QString &name="")
template<class myType>
void put_vector (QDomNode &parent, const vector< myType > &v, const QString &name="")


Detailed Description

This class handles all input and output to Sailcut XML documents.

Definition at line 49 of file saildoc.h.


Constructor & Destructor Documentation

CSailDoc::CSailDoc (  ) 

This contains all the input and output functions to read and write the sail, hull, rig, boat data to file. Constructs an empty CSailDoc object.

Definition at line 35 of file saildoc.cpp.

References createElement(), and top.

CSailDoc::CSailDoc ( const QString &  filename  ) 

Constructs a CSailDoc from a given XML file.

Parameters:
filename 

Definition at line 47 of file saildoc.cpp.

References top.


Member Function Documentation

QDomElement CSailDoc::createElement ( const QString &  type  )  [inline]

Creates an element of the given type.

Definition at line 56 of file saildoc.h.

Referenced by createElement(), CSailDoc(), put(), and put_vector().

QDomElement CSailDoc::createElement ( const QString &  type,
const QString &  name 
)

Creates an element with the given name and type.

Parameters:
type a string containing the type of the element
name a string containing the name of the element

Definition at line 72 of file saildoc.cpp.

References createElement().

QDomElement CSailDoc::createElement ( const QString &  type,
const QString &  name,
const QString &  value 
)

Creates an element with the given name, type and value.

Parameters:
type a string containing the type of the element
name a string containing the name of the element
value a string containing the name of the element

Definition at line 86 of file saildoc.cpp.

References createElement().

QDomElement CSailDoc::findElement ( const QDomNode &  parent,
const QString &  type,
const QString &  name 
)

Looks for an element with a given name and type in the current XML document.

Parameters:
parent the parent node
type a string containing the type of the element
name a string containing the name of the element

Definition at line 100 of file saildoc.cpp.

Referenced by get(), and get_vector().

void CSailDoc::get ( const QDomNode &  parent,
int &  i,
const QString &  name 
)

Reads an integer value from an XML document.

Parameters:
parent the parent node
i the integer
name the name of the value

Definition at line 137 of file saildoc.cpp.

References findElement().

Referenced by XmlWriterTempl< CBoatDef >::read().

void CSailDoc::get ( const QDomNode &  parent,
unsigned int &  i,
const QString &  name 
)

Reads an unsigned integer value from an XML document.

Parameters:
parent the parent node
i the unsigned integer
name the name of the value

Definition at line 152 of file saildoc.cpp.

void CSailDoc::get ( const QDomNode &  parent,
real &  r,
const QString &  name 
)

Reads a real value from an XML document.

Parameters:
parent the parent node
r the real value
name the name of the value

Definition at line 167 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
string &  s,
const QString &  name 
)

Reads a std::string value from an XML document.

Parameters:
parent the parent node
s the string
name the name of the string

Definition at line 182 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
QString &  s,
const QString &  name 
)

Reads a QString string value from an XML document.

Parameters:
parent the parent node
s the string
name the name of the string

Definition at line 197 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
CPoint3d p,
const QString &  name 
)

Reads a CPoint3D point with x,y,z coordinates from an XML document.

Parameters:
parent the parent node
p the 3D point
name the name of the 3D point

Definition at line 212 of file saildoc.cpp.

References findElement(), CVector3d::x(), CVector3d::y(), and CVector3d::z().

void CSailDoc::get ( const QDomNode &  parent,
enumBoatElementType &  t,
const QString &  name 
)

Reads an enumBoatElementType enumerated Boat Element Type from an XML document.

Parameters:
parent the parent node
t the enumBoatElementType
name the name of the value

Definition at line 312 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
enumPanelGroupType &  t,
const QString &  name 
)

Reads an enumPanelGroupType enumerated Panel Group Type from an XML document.

Parameters:
parent the parent node
t the enumPanelGroupType
name the name of the value

Definition at line 231 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
enumSailCut &  c,
const QString &  name 
)

Reads an enumSailCut enumerated Sail Cut type from an XML document.

Parameters:
parent the parent node
c the enumSailCut
name the name of the value

Definition at line 262 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
enumSailType &  t,
const QString &  name 
)

Reads an enumSailType enumerated Sail Type from an XML document.

Parameters:
parent the parent node
t the enumSailType
name the name of the value

Definition at line 291 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
CHullDef d,
const QString &  name 
)

Reads a CHullDef hull definition from an XML document.

Parameters:
parent the parent node
d the hull definition
name the name of the hull definition

read hull bottom data

read hull deck data

read hull stem angle

read hull transom angle

read hull side planks data

Definition at line 335 of file saildoc.cpp.

References CHullDef::BaftHeight, CHullDef::BaftShape, CHullDef::BaftW, CHullDef::BBW, CHullDef::BBWPos, CHullDef::BDeadriseA, CHullDef::BfwdHeight, CHullDef::BfwdShape, CHullDef::BLWL, CHullDef::BSlopeA, CHullDef::BSweepA, CHullDef::DaftHeight, CHullDef::DfwdHeight, CHullDef::DSlopeA, findElement(), CHullDef::hullID, CHullDef::LowPlankA, CHullDef::NBPlank, CHullDef::StemA, CHullDef::TopPlankA, and CHullDef::TransomA.

void CSailDoc::get ( const QDomNode &  parent,
CSailDef d,
const QString &  name 
)

Reads a CSailDef sail definition from an XML document. NEW members are added at the end of the list See also CSailDoc::put(QDomNode &parent, const CSailDef &d, const QString &name )

Parameters:
parent the parent node
d the sail definition
name the name of the sail definition

read sail cut layout and type

read sail boat data

read sail sides

read sail shape of sides

read sail cloth width, seam and hems width

read sail twist

read sail mould

read sail sheeting angle

NOTE : we maintain backward file format compatibility by adding below all new members in the order they are introduced in CSailDoc::put

read Sail ID

read Radial sections

read Radial gores

read Luff gores

read Wing dihedral angle

read Foot hem width

catch read error to avoid killing the program

Definition at line 383 of file saildoc.cpp.

References CSailDef::clothW, CSailDef::dihedralDeg, findElement(), CSailDef::footHemW, CSailDef::footL, CSailDef::footR, CSailDef::footRP, CSailDef::foreI, CSailDef::foreJ, CSailDef::gaffDeg, CSailDef::gaffL, CSailDef::gaffR, CSailDef::gaffRP, CSailDef::hemsW, CSailDef::leechHemW, CSailDef::leechL, CSailDef::leechR, CSailDef::leechRP, CSailDef::LOA, CSailDef::luffL, CSailDef::luffR, CSailDef::luffRP, CSailDef::mould, CSailDef::nbGores, CSailDef::nbLuffGores, CSailDef::nbSections, CSailDef::rake, CSailDef::sailCut, CSailDef::sailID, CSailDef::sailType, CSailDef::seamW, CSailDef::sheetDeg, CSailDef::tackX, CSailDef::tackY, and CSailDef::twistDeg.

void CSailDoc::get ( const QDomNode &  parent,
CSide s,
const QString &  name 
)

Reads a CSide sail side from an XML document.

Parameters:
parent the parent node
s the sail side
name the name of the sail side

Definition at line 470 of file saildoc.cpp.

References findElement(), and get_vector().

void CSailDoc::get ( const QDomNode &  parent,
CPanel p,
const QString &  name 
)

Reads a CPanel sail panel from an XML document.

Parameters:
parent the parent node
p the panel
name the name of the panel

Definition at line 484 of file saildoc.cpp.

References CPanel::bottom, CPanel::cutBottom, CPanel::cutLeft, CPanel::cutRight, CPanel::cutTop, findElement(), CPanel::hasHems, CPanel::left, CPanel::right, and CPanel::top.

void CSailDoc::get ( const QDomNode &  parent,
CBoatDef d,
const QString &  name 
)

Reads a CBoatDef boat definition from an XML document.

Parameters:
parent the parent node
d the boat definition
name the name of the boat definition

Definition at line 561 of file saildoc.cpp.

References findElement(), and get_vector().

void CSailDoc::get ( const QDomNode &  parent,
CBoatElement s,
const QString &  name 
)

Reads a CBoatElement from an XML document.

Parameters:
parent the parent node
s the boat element
name the name of the boat element

Definition at line 575 of file saildoc.cpp.

References CBoatElement::filename, findElement(), CBoatElement::origin, and CBoatElement::type.

void CSailDoc::get ( const QDomNode &  parent,
CPanelGroup g,
const QString &  name 
)

Reads a CPanelGroup from an XML document.

Parameters:
parent the parent node
g the panel group
name the name of the panel group

Definition at line 514 of file saildoc.cpp.

References CPanelGroup::child, findElement(), get_vector(), CPanelGroup::title, and CPanelGroup::type.

void CSailDoc::get ( const QDomNode &  parent,
CProfile p,
const QString &  name 
)

Reads a CProfile sail profile from an XML document.

Parameters:
parent the parent node
p the profile
name the name of the profile

Definition at line 542 of file saildoc.cpp.

References findElement().

void CSailDoc::get ( const QDomNode &  parent,
CSailMould m,
const QString &  name 
)

Reads a CSailMould sail mould from an XML document.

Parameters:
parent the parent node
m the mould
name the name of the mould

Definition at line 592 of file saildoc.cpp.

References findElement(), get_vector(), CSailMould::profile, and CSailMould::vertpos.

void CSailDoc::get ( const QDomNode &  parent,
CPrefs p,
const QString &  name 
)

Reads a CPrefs set of preferences from an XML document.

Parameters:
parent the parent node
p the preferences
name the name of the preferences

Definition at line 607 of file saildoc.cpp.

References findElement(), get_vector(), CPrefs::helpWindowHeight, CPrefs::helpWindowWidth, CPrefs::language, CPrefs::mainWindowHeight, CPrefs::mainWindowWidth, and CPrefs::mruDocuments.

void CSailDoc::get ( const QDomNode &  parent,
CRigDef d,
const QString &  name 
)

Reads a CRigDef rig definition from an XML document.

Parameters:
parent the parent node
d the rig definition
name the name of the rig definition

read fore triangle data

read mast data

read shrouds data

read spreaders data

read mainsail data

Definition at line 633 of file saildoc.cpp.

References CRigDef::BAD, CRigDef::CSB, CRigDef::CSH, findElement(), CRigDef::foreI, CRigDef::foreJ, CRigDef::HAD, CRigDef::LSB, CRigDef::MBase, CRigDef::MCord, CRigDef::MHeight, CRigDef::MRakeD, CRigDef::MRakeM, CRigDef::MRnd, CRigDef::MRndPos, CRigDef::MWidth, CRigDef::rigID, CRigDef::SPH, CRigDef::SPNB, and CRigDef::SPW.

void CSailDoc::put ( QDomNode &  parent,
const int &  i,
const QString &  name = "" 
)

Puts an integer value to an XML document.

Definition at line 680 of file saildoc.cpp.

References createElement().

Referenced by put(), put_vector(), and XmlWriterTempl< CBoatDef >::write().

void CSailDoc::put ( QDomNode &  parent,
const unsigned int &  i,
const QString &  name = "" 
)

Puts an unsigned integer value to an XML document.

Definition at line 689 of file saildoc.cpp.

References put().

void CSailDoc::put ( QDomNode &  parent,
const real &  r,
const QString &  name = "" 
)

Puts a real value to an XML document.

Definition at line 697 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const string &  s,
const QString &  name = "" 
)

Puts a std::string value to an XML document.

Definition at line 706 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const QString &  s,
const QString &  name = "" 
)

Puts a QString value to an XML document.

Definition at line 715 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const CPoint3d p,
const QString &  name = "" 
)

Puts a CPoint3d to an XML document.

Definition at line 724 of file saildoc.cpp.

References createElement(), put(), CVector3d::x(), CVector3d::y(), and CVector3d::z().

void CSailDoc::put ( QDomNode &  parent,
const enumBoatElementType &  t,
const QString &  name = "" 
)

Puts an enumBoatElementType enumerated Boat Element Type to an XML document.

Definition at line 737 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const enumPanelGroupType &  t,
const QString &  name = "" 
)

Puts an enumPanelGroupType enumerated Panel Group Type to an XML document.

Definition at line 762 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const enumSailCut &  c,
const QString &  name = "" 
)

Puts an enumSailCut enumerated Sail Cut Type to an XML document.

Definition at line 784 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const enumSailType &  t,
const QString &  name = "" 
)

Puts an enumSailType enumerated Sailf Type to an XML document.

Definition at line 818 of file saildoc.cpp.

References createElement().

void CSailDoc::put ( QDomNode &  parent,
const CBoatDef d,
const QString &  name = "" 
)

Put a CBoatDef boat definition to an XML document.

Definition at line 1037 of file saildoc.cpp.

References createElement(), and put_vector().

void CSailDoc::put ( QDomNode &  parent,
const CBoatElement s,
const QString &  name = "" 
)

Put a CBoatElement elements of a boat (sail, hull, rig) to an XML document.

Definition at line 1048 of file saildoc.cpp.

References createElement(), CBoatElement::filename, CBoatElement::origin, put(), and CBoatElement::type.

void CSailDoc::put ( QDomNode &  parent,
const CHullDef d,
const QString &  name = "" 
)

void CSailDoc::put ( QDomNode &  parent,
const CSailDef d,
const QString &  name = "" 
)

Puts a CSailDef sail definition to an XML document. NEW members shall be added at THE END OF THE LIST in order to maintain backward comaptibility of files.

See also CSailDoc::get(QDomNode &parent, const CSailDef &d, const QString &name )

write Sail cut and Sail type

write Sail Boat data

write Sides of the sail

write Shape of sail sides

write sail Cloth width, Seam and Hems width

write sail Twist angle

write sail Sheeting angle

write sail Mould

write sail ID

write sail Radial sections

write sail Radial gores

write sail Luff gores

write sail Wing dihedral angle

write sail Foot hem width

NOTE: write here below future new elements of sail

Definition at line 886 of file saildoc.cpp.

References CSailDef::clothW, createElement(), CSailDef::dihedralDeg, CSailDef::footHemW, CSailDef::footL, CSailDef::footR, CSailDef::footRP, CSailDef::foreI, CSailDef::foreJ, CSailDef::gaffDeg, CSailDef::gaffL, CSailDef::gaffR, CSailDef::gaffRP, CSailDef::hemsW, CSailDef::leechHemW, CSailDef::leechL, CSailDef::leechR, CSailDef::leechRP, CSailDef::LOA, CSailDef::luffL, CSailDef::luffR, CSailDef::luffRP, CSailDef::mould, CSailDef::nbGores, CSailDef::nbLuffGores, CSailDef::nbSections, put(), CSailDef::rake, CSailDef::sailCut, CSailDef::sailID, CSailDef::sailType, CSailDef::seamW, CSailDef::sheetDeg, CSailDef::tackX, CSailDef::tackY, and CSailDef::twistDeg.

void CSailDoc::put ( QDomNode &  parent,
const CSide s,
const QString &  name = "" 
)

Puts a CSide sail side to an XML document.

Definition at line 963 of file saildoc.cpp.

References createElement(), and put_vector().

void CSailDoc::put ( QDomNode &  parent,
const CPanel p,
const QString &  name = "" 
)

void CSailDoc::put ( QDomNode &  parent,
const CPanelGroup g,
const QString &  name = "" 
)

Puts a CPanelGroup to an XML document.

Definition at line 998 of file saildoc.cpp.

References CPanelGroup::child, createElement(), put(), put_vector(), CPanelGroup::title, and CPanelGroup::type.

void CSailDoc::put ( QDomNode &  parent,
const CProfile p,
const QString &  name = "" 
)

Puts a CProfile sail profile to an XML document.

Definition at line 1012 of file saildoc.cpp.

References createElement(), CProfile::getDepth(), CProfile::getLeech(), CProfile::getLuff(), and put().

void CSailDoc::put ( QDomNode &  parent,
const CSailMould m,
const QString &  name = "" 
)

Puts a CSailMould sail mould to an XML document.

Definition at line 1025 of file saildoc.cpp.

References createElement(), CSailMould::profile, put(), put_vector(), and CSailMould::vertpos.

void CSailDoc::put ( QDomNode &  parent,
const CPrefs p,
const QString &  name = "" 
)

void CSailDoc::put ( QDomNode &  parent,
const CRigDef d,
const QString &  name = "" 
)

Puts a CRigDef rig definition to an XML document.

write rig fore triangle

write rig mast data

write rig shrouds data

write rig spreaders data

write rig mainsail data

Definition at line 1078 of file saildoc.cpp.

References CRigDef::BAD, createElement(), CRigDef::CSB, CRigDef::CSH, CRigDef::foreI, CRigDef::foreJ, CRigDef::HAD, CRigDef::LSB, CRigDef::MBase, CRigDef::MCord, CRigDef::MHeight, CRigDef::MRakeD, CRigDef::MRakeM, CRigDef::MRnd, CRigDef::MRndPos, CRigDef::MWidth, put(), CRigDef::rigID, CRigDef::SPH, CRigDef::SPNB, and CRigDef::SPW.

void CSailDoc::toFile ( const QString &  filename  ) 

Writes the CSailDoc document to file.

Exceptions:
an exception if writing failed.

Definition at line 1122 of file saildoc.cpp.

Referenced by XmlWriterTempl< CBoatDef >::write().

template<class myType>
void CSailDoc::get_vector ( QDomNode &  parent,
vector< myType > &  v,
const QString &  name = "" 
) [inline, protected]

Reads a vector of elements from an XML document.

Parameters:
parent the parent node
v the vector
name the name of the vector

Definition at line 145 of file saildoc.h.

References findElement().

Referenced by get().

template<class myType>
void CSailDoc::put_vector ( QDomNode &  parent,
const vector< myType > &  v,
const QString &  name = "" 
) [inline, protected]

Writes a vector of elements to an XML document.

Parameters:
parent the parent node
v the vector
name the name of the vector

Definition at line 168 of file saildoc.h.

References createElement(), and put().

Referenced by put().


Member Data Documentation

QDomElement CSailDoc::top

the toplevel element

Definition at line 134 of file saildoc.h.

Referenced by CSailDoc(), XmlWriterTempl< CBoatDef >::read(), and XmlWriterTempl< CBoatDef >::write().


The documentation for this class was generated from the following files:

Generated on Sun Mar 22 21:38:32 2009 for Sailcut CAD by  doxygen 1.5.6