From bf142b61bb2ab69b27b5204bd8f83bb4f0a94cd8 Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 26 Dec 2009 13:43:00 +0000 Subject: [PATCH] docu for wob git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@352 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- doc/prog_woc.html | 15 ++++- src/overview.cpp | 3 - wob/basics.wolf | 3 +- wob/event.wolf | 7 +- wob/magicsmoke.wolf | 8 ++- wob/order.wolf | 103 ++++++++++++++++++----------- woc/htmlout.cpp | 180 +++++++++++++++++++++++++++++++++++++++++++++------ woc/htmlout.h | 6 +- woc/phpout.cpp | 54 ++++++++-------- woc/processor.cpp | 71 ++++++++++++++++++-- woc/processor.h | 59 +++++++++++++++-- woc/qtout.cpp | 10 ++-- 12 files changed, 395 insertions(+), 124 deletions(-) diff --git a/doc/prog_woc.html b/doc/prog_woc.html index 336a220..66823d4 100644 --- a/doc/prog_woc.html +++ b/doc/prog_woc.html @@ -26,6 +26,7 @@ Each wolf file must be enclosed in the <Wolf> and </Wolf> tags. The first
 <Wolf>
+  <Doc>Documentation...</Doc>
   <Project baseDir=".." wobDir="wob"/>
   <Version comm="0100" needcomm="0100" humanReadable="1.1 alpha" svnTarget="."/>
 </Wolf>
@@ -33,6 +34,8 @@ Each wolf file must be enclosed in the <Wolf> and </Wolf> tags. The first
 
 Above the <Project> tag tells woc what the overall project directory is (relative to its current working directory) and where, relative to the baseDir, it will find all wolf files.

+The <Doc> tag can be used to create project documentation. Each tag generates one paragraph. HTML can be embedded by escaping the "<" character as "&lt;".

+ The <Version> tag describes the communication protocol: @@ -111,6 +114,8 @@ Table attributes:
baseoptional, contains the class that this tables class is derived from, the base class must be derived from WobTable (default is to derive from WobTable directly)

+The Table tag can have Doc subtags to embed documentation.

+ Column attributes: @@ -139,6 +144,8 @@ All names in table descriptions must follow a very strict syntax in order to be The Value tags for enum types function similar to enums in C++. If a value attribute is given that value is assigned to the enum symbol, if no value is given the previous one is increased by one (the first value is 0).

+Columns can be documented by adding the description directly to the Column tag or by embedding it with a Doc tag inside the Column tag. Enum values can be documented by embedding the description between <Value> and </Value>.

+

Communication Abstraction Layer

The Communication Abstraction Layer is the servers upper bound towards the client. It hides the complexities of serializing data onto the network transport protocol by providing communication classes that do this automatically. The configuration of this layer is split into two major components: communication classes and transactions. While the communication classes describe what data can be transported over the connection, the transactions describe what operations can be performed.

@@ -208,7 +215,9 @@ The ToXml tag provides valid serializations. Each serialization must have a name <ToXml name="Full">orderid customerid seller amountpaid state amountdue tickets/inOrder vouchers/inOrder</ToXml> -Above the property "tickets" is a list of Ticket and "inOrder" is a serialization defined above for Ticket. +Above the property "tickets" is a list of Ticket and "inOrder" is a serialization defined above for Ticket.

+ +Classes can be documented by adding Doc subtags. Properties can be documented by adding the description directly into the Property tag. Enum values can be documented by adding the description directly into the Value tag.

Transactions

@@ -260,7 +269,9 @@ Call attributes:
AttributeDescription
methodthe function to call - it must take exactly one argument: the transaction object

-Transactions are represented as classes. On the client side they are used to execute the query and to represent the result. On the server side they internally verify the input and authenticate the transaction and are then used to take and encode the output or possible error conditions. +Transactions are represented as classes. On the client side they are used to execute the query and to represent the result. On the server side they internally verify the input and authenticate the transaction and are then used to take and encode the output or possible error conditions.

+ +Transactions can be documented by adding Doc tags. Inputs and Outputs can be documented by adding the description directly into the Var tags.

Server Abstraction Layer

diff --git a/src/overview.cpp b/src/overview.cpp index d83be45..33d9424 100644 --- a/src/overview.cpp +++ b/src/overview.cpp @@ -21,9 +21,6 @@ #include "orderwin.h" #include "overview.h" -//#include "user.h" -//#include "host.h" - #include #include #include diff --git a/wob/basics.wolf b/wob/basics.wolf index b891a82..90a3e41 100644 --- a/wob/basics.wolf +++ b/wob/basics.wolf @@ -32,10 +32,11 @@ + This transaction allows to make a complete database backup. The backup file is replayed into the database via the admin.php interface. - + Contains the structured backup data. diff --git a/wob/event.wolf b/wob/event.wolf index 6431aef..b7db45c 100644 --- a/wob/event.wolf +++ b/wob/event.wolf @@ -8,9 +8,10 @@ --> - - - + Stores rooms that can be used for events. + Name of the room + Amount of people fitting into the room, zero means unlimited, this can be overridden per event. + A short description of the room to help users. Currently not used extensively.
diff --git a/wob/magicsmoke.wolf b/wob/magicsmoke.wolf index be0a76a..232f398 100644 --- a/wob/magicsmoke.wolf +++ b/wob/magicsmoke.wolf @@ -7,18 +7,20 @@ - see COPYING.AGPL for details --> + These files describe the database schema and communication protocol of MagicSmoke. + (c) Konrad Rosenbaum, 2009<br/>these files are protected under the GNU AGPLv3 or at your option any newer - + Time at which the change was made. - + The user name of the user who made the change. - + The transaction name under which the change was made. diff --git a/wob/order.wolf b/wob/order.wolf index 60c5ffd..6c9a02a 100644 --- a/wob/order.wolf +++ b/wob/order.wolf @@ -8,12 +8,14 @@ -->
- - - - + This table contains descriptions of shipping methods, the actual cost can be overridden in each order. + + default cost of this shipping type in cents + flags showing who can use this method + description for the shipping type
+ This table contains acceptable payment methods. (Under construction.) @@ -21,46 +23,56 @@
+ This table contains all orders and sales. - + + ID of the customer connected to this order. + - + User name of the user who entered it into the system. "_web" for the online system. - - + + If not null: the address the invoice goes to. + + + If not null: the address the delivery goes to. + If null: assumed to be identical to invoiceaddress. + - - - - - - + Status the order is in right now. + The order has been placed, but not acted upon yet. + The order has been sent out or handed to the customer. + Alias for Sent. Semantically: it is sold if it has been sent and paid. + The order has been cancelled, if anything has been paid, it must be paid back. + The order is just a reservation for a limited time, application logic must determine the timeout. + The order is closed out of the system - the payment status is ignored from now on. Currently not used. + + When the order was created + When the order was sent to the customer + comments made on web form (eg. "urgently needed for dads birthday") + + how much has been paid already (including used vouchers); + this is for comparison with the price fields in ticket and voucher tables + + shipping price; this is not re-imbursed for orders that have been sent and then cancelled + + pointer to shipping type (none per default, programmatic default is in config) - - - - - - - - - - - - - + Returns the tickets for this order + Returns the vochers sold by this order + Returns additional sold items for this order
- + a 8-32 char code (code39: case-insensitive letters+digits) for the ticket; + automatically generated @@ -69,15 +81,23 @@ - - - - - - - - - + + The ticket is reserved for a customer, it blocks the seat, but is not to be paid yet. + + The ticket is ordered/sold and possibly paid for (payment is stored in its order). + + The ticket has been used. + + The ticket has been given back for some reason and needs to be re-imbursed (if paid already). + Alias for Cancelled + + Masking value: if this bit is set the ticket blocks a seat. + + Masking value: if this bit is set the ticket must be paid by the customer. + + Masking value: combines Block+Pay - the ticket can be used to watch a show. + + Masking value: if this bit is set the ticket can still be cancelled. @@ -100,17 +120,19 @@
+ A saleable product other than tickets or vouchers (eg. merchandizing). - + usually the EAN code
+ A sold item other than a ticket or voucher. @@ -121,8 +143,9 @@ + This class represents the data of a ticket as stored in the database. - + uniquely identifies the ticket, this ID is automatically generated when the ticket is created by the server diff --git a/woc/htmlout.cpp b/woc/htmlout.cpp index 05bfadf..c15205f 100644 --- a/woc/htmlout.cpp +++ b/woc/htmlout.cpp @@ -18,7 +18,8 @@ WocHtmlOut::WocHtmlOut(QDomElement&el) { qDebug("Info: creating Html Output Generator."); - m_basedir=WocProcessor::instance()->baseDir()+"/"+el.attribute("sourceDir","."); + WocProcessor*woc=WocProcessor::instance(); + m_basedir=woc->baseDir()+"/"+el.attribute("sourceDir","."); m_subdir=el.attribute("subDir","htmlwob"); bool clean=str2bool(el.attribute("clean","0")); //cleanup directory (remove normal files, assume remainder is harmless) @@ -42,7 +43,28 @@ WocHtmlOut::WocHtmlOut(QDomElement&el) m_index.write(QByteArray("Project Index\n")); m_index.write(QByteArray("\n")); - //TODO: write project info + //write project info + QString inf="

Project "+woc->projectName()+"

\n"; + inf+="Human Readable Version: "+woc->verHR()+"
"; + inf+="Communication Layer Version: "+woc->verComm()+"
"; + inf+="Minimum Compatible Version: "+woc->verNeedComm()+"

"; + + inf+="SVN Repository URL: "+woc->svnRepositoryUrl()+"
"; + inf+="SVN Repository Root: "+woc->svnRepositoryRoot()+"
"; + inf+="SVN Revision: "+woc->svnRevision()+"

"; + + inf+="Database Instance Object: "+woc->dbInst()+"
"; + inf+="Database Schema Object: "+woc->dbSchema()+"
"; + inf+="Database Schema Version: "+woc->dbVersion()+"

"; + + m_index.write(inf.toAscii()); + + //write global docu + QStringList dcs=woc->docStrings(); + for(int i=0;i\n"; + m_index.write(inf.toAscii()); + } } WocHtmlOut::~WocHtmlOut(){} @@ -50,7 +72,9 @@ WocHtmlOut::~WocHtmlOut(){} void WocHtmlOut::finalize() { //TODO: write index table content - m_index.write(QByteArray("

Classes

\n
    \n")); + m_index.write(QByteArray("

    Index

    \n")); + m_index.write(QByteArray("
\n")); + m_index.write(QByteArray("

Classes

Transactions

Tables

    \n")); QStringList sl=WocProcessor::instance()->classNames(); QString s; qSort(sl); @@ -58,7 +82,7 @@ void WocHtmlOut::finalize() s+="
  • "+sl[i]+"
  • \n"; m_index.write(s.toAscii()); - m_index.write(QByteArray("
\n

Transactions

\n
    ")); + m_index.write(QByteArray("
    ")); sl=WocProcessor::instance()->transactionNames(); s=""; qSort(sl); @@ -66,7 +90,7 @@ void WocHtmlOut::finalize() s+="
  • "+sl[i]+"
  • \n"; m_index.write(s.toAscii()); - m_index.write(QByteArray("
\n

Tables

\n
    ")); + m_index.write(QByteArray("
    ")); sl=WocProcessor::instance()->tableNames(); s=""; qSort(sl); @@ -74,7 +98,7 @@ void WocHtmlOut::finalize() s+="
  • "+sl[i]+"
  • \n"; m_index.write(s.toAscii()); - m_index.write(QByteArray("
\n")); + m_index.write(QByteArray("
\n")); m_index.write(QByteArray("\n\n")); m_index.close(); @@ -95,7 +119,17 @@ void WocHtmlOut::newTable(const WocTable&tbl) QString hcd; //table declaration hcd+="

Table "+cn+"

\n"; - hcd+="\n"; + + if(tbl.isAuditable()){ + hcd+="

This table is audited, see " + +tbl.name()+"_audit for details.

\n"; + } + + QStringList td=tbl.docStrings(); + for(int i=0;i\n"; + + hcd+="
Column NameTypeProperties
\n"; QStringList cl=tbl.columns(); for(int i=0;i\n"; + hcd+="\n"; } hcd+="
Column NameTypePropertiesDocu
"+tbl.columnType(cl[i])+""; @@ -113,21 +147,57 @@ void WocHtmlOut::newTable(const WocTable&tbl) hcd+="Indexed "; if(tbl.columnIsUnique(cl[i])) hcd+="Unique"; - hcd+="
"+tbl.columnDoc(cl[i])+"
\n"; //enums for(int i=0;i >lst=tbl.columnEnums(cl[i]); + QListlst=tbl.columnEnums(cl[i]); if(lst.size()>0){ hcd+="

Enum for column "+cl[i]+"

\n
    \n"; - for(int j=0;j\n"; + for(int j=0;j0){ + hcd+="

    Foreign Getters

    \n
      "; + for(int i=0;i >pre=tbl.presets(); + if(pre.size()>0){ + hcd+="

      Presets

      \n\n"; + cl=tbl.columns(); + for(int i=0;i"; + hcd+="\n"; + for(int i=0;i\n"; + QStringList doc=cls.docStrings(); + for(int i=0;i\n"; + htm.write(hcd.toAscii()); //enums classEnums(cls,htm); @@ -156,7 +230,8 @@ void WocHtmlOut::newClass(const WocClass&cls) //properties classProperties(cls,htm); - //TODO: mappings + //mappings + classMappings(cls,htm); //lead out htm.write(QByteArray("\n")); @@ -171,10 +246,11 @@ void WocHtmlOut::classEnums(const WocClass&cls,QFile&hdr) //type hcd+="

      enum "+k[i]+"

      \n"; hcd+="
      "; - hcd+="\n"; - QList >ev=cls.enumValues(k[i]); + hcd+="\n"; + QListev=cls.enumValues(k[i]); for(int j=0;j\n"; + hcd+="\n"; } hcd+="
      SymbolValue
      SymbolValueDocu
      "+QString::number(ev[j].second)+"
      "+ev[j].name+""+QString::number(ev[j].val) + +""+ev[j].doc+"
      \n"; } @@ -187,14 +263,44 @@ void WocHtmlOut::classProperties(const WocClass&cls,QFile&hdr) if(k.size()==0)return; QString hcd; //declare members - hcd="

      Properties

      \n"; + hcd="

      Properties

      \n\n"; //write hdr.write(hcd.toAscii()); } +void WocHtmlOut::classMappings(const WocClass&cls,QFile&hdr) +{ + QStringList k=cls.mappingTables(); + if(k.size()==0)return; + QString hcd; + for(int i=0;i"+k[i]+"\n"; + hcd+="\n"; + hcd+="\n"; + QMap map=cls.mapping(k[i]); + QStringList k2=map.keys(); + for(int j=0;j\n"; + } + hcd+="
      PropertyColumn
      "+map[k2[j]]+"
      \n"; + } + + hdr.write(hcd.toAscii()); +} + void WocHtmlOut::newTransaction(const WocTransaction&trn) { QString cn=trn.name(); @@ -207,18 +313,50 @@ void WocHtmlOut::newTransaction(const WocTransaction&trn) //basics QStringList in=trn.inputNames(); QStringList out=trn.outputNames(); + QStringList doc=trn.docStrings(); //lead in QString hcd; hcd="Transaction "+cn+"\n

      Transaction "+cn+"

      \n"; + //auth mode + hcd+="

      Authentication mode: "; + switch(trn.authMode()){ + case WocTransaction::Checked:hcd+="Checked (known user, must have the privilege)";break; + case WocTransaction::Auth:hcd+="Authenticated (known user, any/no privileges)";break; + case WocTransaction::Open:hcd+="Open (unauthenticated, any user)";break; + default:hcd+="Ooops. Unknown Mode.";break; + } + hcd+="

      \n"; + //docu + for(int i=0;i\n"; + //in/out hcd+="

      Inputs:

      \n
        \n"; for(int i=0;i\n"; - //TODO: link class types + hcd+="
      • "+in[i]+": "; + QString t=trn.inputType(in[i]); + if(trn.isObjectType(t)) + hcd+=""; + hcd+=t; + if(trn.isObjectType(t)) + hcd+=""; + //add docu + t=trn.inputDoc(in[i]); + if(t!="")hcd+="
        "+t; + hcd+="
      • \n"; } hcd+="
      \n

      Outputs:

      \n
        \n"; for(int i=0;i\n"; - //TODO: link class types + hcd+="
      • "+out[i]+": "; + QString t=trn.outputType(out[i]); + if(trn.isObjectType(t)) + hcd+=""; + hcd+=t; + if(trn.isObjectType(t)) + hcd+=""; + //add docu + t=trn.outputDoc(out[i]); + if(t!="")hcd+="
        "+t; + hcd+="
      • \n"; } hcd+="
      \n"; hcd+="\n"; diff --git a/woc/htmlout.h b/woc/htmlout.h index 4b2dab0..c3650d9 100644 --- a/woc/htmlout.h +++ b/woc/htmlout.h @@ -37,10 +37,8 @@ class WocHtmlOut:public WocOutput void classEnums(const WocClass&,QFile&); /**helper: generate properties*/ void classProperties(const WocClass&,QFile&); - /**helper: generate constructors/deserializer/copiers*/ - void classDeserializer(const WocClass&,QFile&); - /**helper: generate serializers*/ - void classSerializers(const WocClass&,QFile&); + /**helper: generate mappings*/ + void classMappings(const WocClass&,QFile&); }; diff --git a/woc/phpout.cpp b/woc/phpout.cpp index 359b434..e1602c9 100644 --- a/woc/phpout.cpp +++ b/woc/phpout.cpp @@ -176,10 +176,10 @@ void WocPHPServerOut::newTable(const WocTable&tbl) //implement enum check for set method of enum columns if(tbl.columnType(cols[i]).startsWith("enum")){ code+="private function verifyValue"+cols[i]+"($v){if(false"; - QList >ens=tbl.columnEnums(cols[i]); + QListens=tbl.columnEnums(cols[i]); QListenvs; for(int j=0;j >ens=tbl.getEnums(); + QListens=tbl.getEnums(); for(int i=0;i >ev=cls.enumValues(k[i]); + QListev=cls.enumValues(k[i]); for(int j=0;j >ev=cls.enumValues(cls.propertyPlainType(prop)); + QListev=cls.enumValues(cls.propertyPlainType(prop)); code+="\tif(is_numeric($value)){\n\t\t$value=$value+0;\n"; for(int j=0;j > ev=cls.enumValues(cls.propertyPlainType(prop)); + QList ev=cls.enumValues(cls.propertyPlainType(prop)); for(int j=0;j >ev=cls.enumValues(cls.propertyPlainType(prop)); + QListev=cls.enumValues(cls.propertyPlainType(prop)); code+="\t$prop=array();\n"; code+="\tforeach($values as $value){\n"; code+="\t\tif(is_numeric($value)){\n\t\t\t$value=$value+0;\n"; acode+="\tif(is_numeric($value)){\n\t\t$value=$value+0;\n"; for(int j=0;jprop_"+prop+"){\n"; - QList > ev=cls.enumValues(cls.propertyPlainType(prop)); + QList ev=cls.enumValues(cls.propertyPlainType(prop)); for(int j=0;j >ev=cls.enumValues(cls.propertyPlainType(prop)); + QListev=cls.enumValues(cls.propertyPlainType(prop)); code+="\tif(is_numeric($value)){\n\t\t$value=$value+0;\n"; for(int j=0;j >ev; + QListev; //check whether there is a reference if(el.hasAttribute("refColumn")){ QStringList ref=el.attribute("refColumn").split(":"); @@ -415,7 +422,7 @@ WocClass::WocClass(const QDomElement&cls) continue; } nxval=el2.attribute("value",QString::number(nxval)).toInt(0,0); - ev.append(QPair(n,nxval)); + ev.append(WocEnum(n,nxval,el2.text().trimmed())); nxval++; //TODO: check that value name does not exist yet } @@ -463,6 +470,12 @@ WocClass::WocClass(const QDomElement&cls) } m_maps.insert(name,map); } + //docu + nl=cls.elementsByTagName("Doc"); + for(int i=0;i(el.attribute("method"),el.attribute("via"))); //TODO: validate foreign getter + //docu + QString s=el.text().trimmed(); + if(s!="")m_fordocs.insert(el.attribute("method"),s); } //Presets @@ -681,6 +697,13 @@ WocTable::WocTable(const QDomElement&tbl) if(ps.size()>0)m_presets.append(ps); } + //Docu + nl=tbl.elementsByTagName("Doc"); + for(int i=0;i WocTable::parseColumn(const QDomElement&el,QString m continue; } nxval=el2.attribute("value",QString::number(nxval)).toInt(0,0); - cl.enumvals.append(QPair(n,nxval)); + cl.enumvals.append(WocEnum(n,nxval,el2.text().trimmed())); nxval++; } //default calls @@ -758,6 +781,15 @@ QPair WocTable::parseColumn(const QDomElement&el,QString m QString meth=el2.attribute("method","false"); cl.methodcalls.insert(lang,meth); } + //docu + nl2=el.childNodes(); + for(int j=0;j(true,cl); } @@ -837,17 +869,17 @@ bool WocTable::hasColumn(QString c)const return false; } -QList > WocTable::columnEnums(QString c)const +QList WocTable::columnEnums(QString c)const { for(int i=0;i >(); + return QList(); } -QList > WocTable::getEnums()const +QList WocTable::getEnums()const { - QList > r; + QList r; for(int i=0;i(nm,tp)); + //docu + QString s=el2.text().trimmed(); + if(s!="")m_indoc.insert(nm,s); } } //call tag @@ -1066,8 +1112,17 @@ WocTransaction::WocTransaction(const QDomElement&root) QString tp=el2.attribute("type"); //TODO: validate type m_output.append(QPair(nm,tp)); + //docu + QString s=el2.text().trimmed(); + if(s!="")m_outdoc.insert(nm,s); } } + //docu + nl=root.elementsByTagName("Doc"); + for(int i=0;i > enumValues(QString t)const{return m_enumvals[t];} + QList enumValues(QString t)const{return m_enumvals[t];} /**returns true if the given mapping exists*/ bool hasMapping(QString m)const{return m_maps.contains(m);} @@ -99,12 +107,18 @@ class WocClass /**returns the method for a specific mapping or an empty string if it does not exist in the specified language*/ QString mapMethod(QString table,QString property,QString lang)const; + /**returns documentation for this class*/ + QStringList docStrings()const{return m_docstrings;} + /**returns documentation for a property*/ + QString propDoc(QString p)const + {if(m_propdoc.contains(p))return m_propdoc[p];else return "";} + private: //valid: parsing the WOLF succeeded //abstract: the class is declared abstract (isAbstract may return true even if this is false) bool m_valid,m_abstract; //name: class name - //base: name of parent class + //base: name of parent class (s=server, c=client) QString m_name,m_sbase,m_cbase; //property info struct s_prop{ @@ -119,9 +133,13 @@ class WocClass }; QMap >m_maps; //enum types: "type-name" => List of ("constant-name",int-constant-value) - QMap > >m_enumvals; + QMap >m_enumvals; //serializers: "name" => List of properties (syntax Objects: "propertyname/Serializer" // QMap m_serial; + + //docu + QStringList m_docstrings; + QMapm_propdoc; //helper: contains predefined types sorted by serialization type static const QStringList attrtypes,elemtypes; @@ -171,12 +189,12 @@ class WocTable /**returns whether the column has a unique constraint*/ bool columnIsUnique(QString)const; /**returns enum definitions of the column - each pair contains the symbolic name in first and the assigned integer value in second*/ - QList > columnEnums(QString)const; + QList columnEnums(QString)const; /**returns the insert call of a column for a specific language; empty string if there is none*/ QString columnCall(QString col,QString lang)const; /**returns all enum definitions of the table; see also columnEnums */ - QList > getEnums()const; + QList getEnums()const; /**returns a list of all foreign definitions - methods that return data from other tables*/ QStringList foreigns()const; @@ -197,13 +215,22 @@ class WocTable WocTable auditTable()const; /**returns the names of audit columns (except auditid)*/ QStringList auditColumns()const; + + /**returns table documentation*/ + QStringList docStrings()const{return m_docstrings;} + /**returns column documentation*/ + QString columnDoc(QString c)const; + /**returns foreign getter documentation*/ + QString foreignDoc(QString c)const + {if(m_fordocs.contains(c))return m_fordocs[c];else return "";} + private: bool m_valid,m_backup,m_audit; QString m_name,m_base; struct s_col { - QString name,type,foreign,defaultval; + QString name,type,foreign,defaultval,doc; bool isnull,isprime,isindex,isunique; - QList >enumvals; + QListenumvals; QMapmethodcalls; }; QListm_columns,m_auditcolumns; @@ -211,6 +238,9 @@ class WocTable QList >m_foreign; QList >m_presets; + QStringList m_docstrings; + QMapm_fordocs; + //helper method: parses a single column element static QPair parseColumn(const QDomElement&,QString); }; @@ -285,12 +315,24 @@ class WocTransaction bool isElementType(QString t)const{return !isAttributeType(t);} /**return true if the type is an object type*/ bool isObjectType(QString t)const{QString p=plainType(t);return p!="astring"&&p!="string"&&p!="int"&&p!="int32"&&p!="int64"&&p!="bool"&&p!="blob";} + + /**return the documentation of the transaction*/ + QStringList docStrings()const{return m_docstrings;} + /**return docu of input element*/ + QString inputDoc(QString v)const + {if(m_indoc.contains(v))return m_indoc[v];else return "";} + /**return docu of output element*/ + QString outputDoc(QString v)const + {if(m_outdoc.contains(v))return m_outdoc[v];else return "";} private: QString m_name; bool m_valid; AuthMode m_mode; QMap m_call; QList >m_input,m_output; + //docu + QStringList m_docstrings; + QMapm_indoc,m_outdoc; }; /**base class of all output generators*/ @@ -370,6 +412,8 @@ class WocProcessor:public QObject QStringList classNames()const; /**returns a list of table names*/ QStringList tableNames()const; + + QStringList docStrings()const{return m_docstrings;} signals: void sfinalize(); void newClass(const WocClass&); @@ -381,6 +425,7 @@ class WocProcessor:public QObject QString m_baseDir,m_wobDir,m_verComm,m_verNeedComm,m_verHR,m_projname; QString m_svnTarget,m_svnRev,m_svnExe,m_svnRoot,m_svnUrl; QString m_dbInst,m_dbSchema,m_dbVer; + QStringList m_docstrings; bool m_error; QList m_tables; diff --git a/woc/qtout.cpp b/woc/qtout.cpp index 44a663e..b59687d 100644 --- a/woc/qtout.cpp +++ b/woc/qtout.cpp @@ -176,7 +176,7 @@ void WocQtClientOut::classEnums(const WocClass&cls,QFile&hdr,QFile&src,QString c for(int i=0;i >ev=cls.enumValues(k[i]); + QListev=cls.enumValues(k[i]); if(ev.size()<1){ qDebug("Error: enums must have at least one member - class %s enum %s",cls.name().toAscii().data(),k[i].toAscii().data()); emit errorFound(); @@ -184,7 +184,7 @@ void WocQtClientOut::classEnums(const WocClass&cls,QFile&hdr,QFile&src,QString c } for(int j=0;j