cvs: pecl(BRANCH_1_1_1) /sdo/commonj/sdo ChangeSummaryBuilder.cpp ChangeSummaryImpl.cpp ChangedDataObjectList.h ChangedDataObjectListImpl.cpp
ChangedDataObjectListImpl.h CopyHelper.cpp CopyHelper.h DataFactoryImpl.cpp DataFactoryImpl.h DataObjectImpl.cpp DataObjectImpl.h DataObjectList.h
DataObjectListImpl.cpp DataObjectListImpl.h EqualityHelper.cpp PropertyDefinition.cpp PropertyDefinition.h PropertyImpl.cpp PropertyList.cpp
PropertyList.h PropertySetting.cpp PropertySetting.h SAX2Attributes.cpp SAX2Parser.cpp SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp SDOUtils.cpp
SDOUtils.h SDOXMLString.cpp SDOXMLWriter.cpp SDOXSDWriter.cpp SequenceImpl.cpp TypeList.cpp TypeList.h XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h
XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h

From: Date: Thu, 07 Dec 2006 12:23:06 +0000
Subject: cvs: pecl(BRANCH_1_1_1) /sdo/commonj/sdo ChangeSummaryBuilder.cpp ChangeSummaryImpl.cpp ChangedDataObjectList.h ChangedDataObjectListImpl.cpp
ChangedDataObjectListImpl.h CopyHelper.cpp CopyHelper.h DataFactoryImpl.cpp DataFactoryImpl.h DataObjectImpl.cpp DataObjectImpl.h DataObjectList.h
DataObjectListImpl.cpp DataObjectListImpl.h EqualityHelper.cpp PropertyDefinition.cpp PropertyDefinition.h PropertyImpl.cpp PropertyList.cpp
PropertyList.h PropertySetting.cpp PropertySetting.h SAX2Attributes.cpp SAX2Parser.cpp SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp SDOUtils.cpp
SDOUtils.h SDOXMLString.cpp SDOXMLWriter.cpp SDOXSDWriter.cpp SequenceImpl.cpp TypeList.cpp TypeList.h XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h
XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-6763@lists.php.net to get a copy of this message
cem Thu Dec 7 12:23:06 2006 UTC Modified files: (Branch: BRANCH_1_1_1) /pecl/sdo/commonj/sdo ChangeSummaryBuilder.cpp ChangeSummaryImpl.cpp ChangedDataObjectList.h ChangedDataObjectListImpl.cpp ChangedDataObjectListImpl.h CopyHelper.cpp CopyHelper.h DataFactoryImpl.cpp DataFactoryImpl.h DataObjectImpl.cpp DataObjectImpl.h DataObjectList.h DataObjectListImpl.cpp DataObjectListImpl.h EqualityHelper.cpp PropertyDefinition.cpp PropertyDefinition.h PropertyImpl.cpp PropertyList.cpp PropertyList.h PropertySetting.cpp PropertySetting.h SAX2Attributes.cpp SAX2Parser.cpp SDOSAX2Parser.cpp SDOSchemaSAX2Parser.cpp SDOUtils.cpp SDOUtils.h SDOXMLString.cpp SDOXMLWriter.cpp SDOXSDWriter.cpp SequenceImpl.cpp TypeList.cpp TypeList.h XMLHelper.h XMLHelperImpl.cpp XMLHelperImpl.h XSDHelper.h XSDHelperImpl.cpp XSDHelperImpl.h Log: Tuscany revision level 483149 fixes a number of problems with sequenced and open types

http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp?r1=1.6&r2=1.6.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6.2.1 --- pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryBuilder.cpp Thu Dec 7 12:23:04 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:04 $ */ #include "commonj/sdo/ChangeSummaryBuilder.h" @@ -95,7 +95,7 @@ if ((*elementsiter).isDeletion) { - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (value.equals (deletions[i].reference)) { @@ -249,7 +249,7 @@ } // it could be a deletion which has not been processed yet - for (int i = 0; i < deletions.size(); i++) + for (unsigned int i = 0; i < deletions.size(); i++) { if (contpath.equals (deletions[i].reference)) { @@ -302,7 +302,7 @@ SDOXMLString refstring = createDeletes[index].value.substring(0,pos); pos = atoi((const char*)(createDeletes[index].value.substring(pos+1))); - for (int k=index+1;k<createDeletes.size();k++) + for (unsigned int k=index+1;k<createDeletes.size();k++) { if (createDeletes[k].type.equals("create")) continue; @@ -329,7 +329,7 @@ { LOGENTRY(INFO,"CSBuilder:buildChangeSummary"); - int i; + unsigned int i; try { if (changeSummaryDO == 0) @@ -395,7 +395,7 @@ else { // its a deletion - match it. - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if (deletions[j].completedprocessing)continue; @@ -421,7 +421,7 @@ std::list<changeAttribute>::iterator a; std::list<changeElement>::iterator e; - for (i = 0; i< changes.size(); i++) + for (unsigned i = 0; i< changes.size(); i++) { DataObjectPtr dob; if (changes[i].reference.isNull()) @@ -451,7 +451,7 @@ } else { - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*a).value.equals (deletions[j].reference)) { @@ -473,7 +473,7 @@ LOGINFO_1(INFO,"CSBuilder Change was a deletion of:%s", (const char*)((*e).path)); - for (int j = 0; j < deletions.size(); j++) + for (unsigned int j = 0; j < deletions.size(); j++) { if ((*e).path.equals (deletions[j].reference)) { @@ -635,7 +635,7 @@ if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -674,7 +674,7 @@ bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { @@ -768,7 +768,7 @@ SDOXMLString curr_loc = ""; if (currentLocation.size() > 0) { - for (int pi = 0; pi < currentLocation.size()-1; pi++) + for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++) { curr_loc = curr_loc + currentLocation[pi]; curr_loc = curr_loc + "/"; @@ -783,7 +783,7 @@ // can we match the current path to a known deletion? bool isDelete = false; - for (int i = 0; i < createDeletes.size(); i++) + for (unsigned int i = 0; i < createDeletes.size(); i++) { if (createDeletes[i].type.equals("delete")) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp?r1=1.8&r2=1.8.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8.2.1 --- pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangeSummaryImpl.cpp Thu Dec 7 12:23:04 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:04 $ */ #include "commonj/sdo/ChangeSummaryImpl.h" @@ -148,7 +148,7 @@ // find any properties which are data objects, log their // deletion first. - int i; + unsigned int i; // Trace for change summaries @@ -173,7 +173,7 @@ if (changeLogIter != changedMap.end()) { // would hope there was an entry - int index; + unsigned int index; if (prop.isMany()) { DataObjectList& dl = container->getList(prop); @@ -377,7 +377,7 @@ // need to be created too PropertyList pl = ob->getInstanceProperties(); - for (int p=0;p<pl.size();p++) + for (unsigned int p=0;p<pl.size();p++) { Property& thisprop = pl[p]; if (!thisprop.getType().isDataType()) @@ -389,7 +389,7 @@ if (thisprop.isMany()) { DataObjectList& dol = ob->getList(thisprop); - for (int ds = 0; ds < dol.size(); ds++) + for (unsigned int ds = 0; ds < dol.size(); ds++) { dp = dol[ds]; if (!dp) continue; @@ -837,7 +837,7 @@ slist.append(new Setting(false,false,0,0,prop,0)); return; } - for (int i=0;i< dol.size(); i++) + for (unsigned int i=0;i< dol.size(); i++) { DataObject* dob = dol[i]; if (prop.getType().isDataType()) { @@ -1275,7 +1275,7 @@ { char* vw = new char[(strlen(c)+1)*sizeof(wchar_t)]; wchar_t* pvw = (wchar_t*)vw; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { pvw[i] = (wchar_t)c[i]; } @@ -1287,7 +1287,7 @@ case Type::BytesType: { char* vc = new char[strlen(c)+1]; - for (int i=0;i< strlen(c);i++) + for (unsigned int i=0;i< strlen(c);i++) { vc[i] = (char)c[i]; } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectList.h?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectList.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5.2.1 --- pecl/sdo/commonj/sdo/ChangedDataObjectList.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectList.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _CHANGEDDATAOBJECTLIST_H_ #define _CHANGEDDATAOBJECTLIST_H_ @@ -68,15 +68,15 @@ * * Gets the nth element of a list */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size() returns the number of list elements. * * Returns the number of list elements */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getType() returns the type of a list element. * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5.2.1 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/ChangedDataObjectListImpl.h" @@ -128,7 +128,7 @@ * */ - RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) + RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos].getObject(); @@ -139,7 +139,7 @@ * */ - const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (int pos) const + const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); return plist[pos].getObject(); @@ -160,7 +160,7 @@ * */ - int ChangedDataObjectListImpl::size () const + unsigned int ChangedDataObjectListImpl::size () const { return plist.size(); } @@ -229,7 +229,7 @@ * checks that the index is in range. */ - void ChangedDataObjectListImpl::validateIndex(int index) const + void ChangedDataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5.2.1 --- pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/ChangedDataObjectListImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _ChangedDataObjectListImplIMPL_H_ #define _ChangedDataObjectListImplIMPL_H_ @@ -71,13 +71,13 @@ ChangedDataObjectListImpl(); virtual ~ChangedDataObjectListImpl(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; virtual DataObject* get(unsigned int pos); virtual ChangedDataObjectList::ChangeType getType(unsigned int pos); - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObject *d, ChangedDataObjectList::ChangeType type); @@ -92,7 +92,7 @@ CHANGEDDATAOBJECT_VECTOR plist; CHANGEDDATAOBJECT_VECTOR getVec() const; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; }; }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.cpp?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.cpp diff -u pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7.2.1 --- pecl/sdo/commonj/sdo/CopyHelper.cpp:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -29,6 +29,8 @@ #include "commonj/sdo/CopyHelper.h" +#include <iostream> +using namespace std; namespace commonj{ namespace sdo{ @@ -105,7 +107,7 @@ void CopyHelper::transferlist(DataObjectList& to, DataObjectList& from, Type::Types t) { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { switch (t) { @@ -177,6 +179,71 @@ } // for } // method + + + void CopyHelper::transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index) + { + switch (p.getTypeEnum()) + { + case Type::BooleanType: + to->addBoolean( p, from->getBooleanValue(index)); + break; + case Type::ByteType: + to->addByte( p, from->getByteValue(index)); + break; + case Type::CharacterType: + to->addCharacter( p, from->getCharacterValue(index)); + break; + case Type::IntegerType: + to->addInteger( p, from->getIntegerValue(index)); + break; + case Type::ShortType: + to->addShort( p,from->getShortValue(index)); + break; + case Type::DoubleType: + to->addDouble( p, from->getDoubleValue(index)); + break; + case Type::FloatType: + to->addFloat( p, from->getFloatValue(index)); + break; + case Type::LongType: + to->addLong( p, from->getLongValue(index)); + break; + case Type::DateType: + to->addDate( p, from->getDateValue(index)); + break; + case Type::BigDecimalType: + case Type::BigIntegerType: + case Type::UriType: + case Type::StringType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + wchar_t * buf = new wchar_t[siz]; + from->getStringValue(index, buf, siz); + to->addString(p, buf, siz); + delete buf; + } + } + break; + case Type::BytesType: + { + unsigned int siz = from->getLength(index); + if (siz > 0) + { + char * buf = new char[siz]; + from->getBytesValue(index, buf, siz); + to->addBytes(p, buf, siz); + delete buf; + } + } + break; + default: + break; + } // switch + } + /** CopyHelper provides static copying helper functions. * * copyShallow() copies the DataType members of the data object. @@ -197,7 +264,9 @@ */ DataObjectPtr CopyHelper::copy(DataObjectPtr dataObject) { - return internalCopy(dataObject, true); + DataObjectPtr newob = internalCopy(dataObject, true); + resolveReferences(dataObject, newob); + return newob; } DataObjectPtr CopyHelper::internalCopy(DataObjectPtr dataObject, @@ -212,54 +281,273 @@ DataObjectPtr newob = fac->create(t); if (!newob) return 0; - PropertyList pl = dataObject->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + if ( dataObject->getType().isSequencedType() ) + { + Sequence* fromSequence = dataObject->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newob->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if ( fromSequence->isText(i) ) + { + const char *text = fromSequence->getCStringValue(i); + toSequence->addText(i, text); + } + else + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqPropertyType.isDataObjectType()) + { + if (!fullCopy) + { + continue; + } + else + { + DataObjectPtr dob; + + // retrieve the data object to be copied + if (seqProperty.isMany()) + { + int index = fromSequence->getListIndex(i); + dob = dataObject->getList(seqProperty)[index]; + } + else + { + dob = dataObject->getDataObject(seqProperty); + } + + // do the copying of referencing + if (dob) + { + // Handle non-containment reference to DataObject + if (seqProperty.isReference()) + { + // add just the reference into the sequence + // This will be resolved to a new reference later + // This is really bad but we need to add something to the + // sequence here to maintain the ordering + toSequence->addDataObject(seqProperty, 0); + } + else + { + // make a copy of the data object itself + // and add it to the sequence + toSequence->addDataObject(seqProperty, + internalCopy(dob, + true)); + } + } + } + } + else + { + // Sequence member is a primitive + transfersequenceitem(toSequence, + fromSequence, + seqProperty, + i); + + } + } // is it a text element + } // for all elements in sequence + } + else { - if (dataObject->isSet(pl[i])) + PropertyList pl = dataObject->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) { - // data objects are only copied in the deep copy case - if (pl[i].getType().isDataObjectType()) + if (dataObject->isSet(pl[i])) { - if (!fullCopy) + // data objects are only copied in the deep copy case + if (pl[i].getType().isDataObjectType()) { - continue; + if (!fullCopy) + { + continue; + } + else + { + if (pl[i].isMany()) + { + DataObjectList& dolold = dataObject->getList(pl[i]); + DataObjectList& dolnew = newob->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + // references are maintained to the old object if it + // is outside of the copy tree + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + dolnew.append(internalCopy(dolold[li],true)); + } + } + } + else + { + DataObjectPtr dob = dataObject->getDataObject(pl[i]); + if (pl[i].isReference()) + { + // have to resolve references in a 2nd pass + } + else + { + newob->setDataObject(pl[i],internalCopy(dob,true)); + } + } + } } - else + else { if (pl[i].isMany()) { DataObjectList& dolold = dataObject->getList(pl[i]); DataObjectList& dolnew = newob->getList(pl[i]); - for (int i=0;i< dolold.size(); i++) + transferlist(dolnew,dolold, pl[i].getTypeEnum()); + } + else + { + transferitem(newob,dataObject, pl[i]); + } + } // else + } + } + } + + return newob; + } + + void CopyHelper::resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO) + { + // Iterate through the properties to find references. + // If the reference is to a DataObject with the copied tree then we can + // set it to reference the DO in the new tree, otherwise it is left unset. + + findReferences(oldDO, newDO, oldDO, newDO); + + } + + void CopyHelper::findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, + DataObjectPtr obj, DataObjectPtr newObj) + { + if ( obj->getType().isSequencedType() ) + { + Sequence* fromSequence = obj->getSequence(); + int sequence_length = fromSequence->size(); + + Sequence* toSequence = newObj->getSequence(); + + for (int i=0;i < sequence_length; i++) + { + if (!fromSequence->isText(i) ) + { + const Property& seqProperty = fromSequence->getProperty(i); + SDOXMLString seqPropertyName = seqProperty.getName(); + const Type& seqPropertyType = seqProperty.getType(); + + if (seqProperty.isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, fromSequence->getDataObjectValue(i)); + if (ref) + { + if (seqProperty.isMany()) { - dolnew.append(internalCopy(dolold[i],true)); + int index = fromSequence->getListIndex(i); + newObj->getList(seqProperty).setDataObject(index, ref); } + else + { + toSequence->setDataObjectValue(i, ref); + } + } - else + } + else if (seqPropertyType.isDataObjectType()) + { + findReferences(oldDO, newDO, fromSequence->getDataObjectValue(i), toSequence->getDataObjectValue(i)); + } + } + + } // for all elements in sequence + + } + else + { + PropertyList pl = obj->getInstanceProperties(); + for (unsigned int i=0;i < pl.size(); i++) + { + if (!obj->isSet(pl[i])) + continue; + + if (!pl[i].getType().isDataObjectType()) + continue; + + if (pl[i].isMany()) + { + DataObjectList& dolold = obj->getList(pl[i]); + DataObjectList& dolnew = newObj->getList(pl[i]); + for (unsigned int li=0;li< dolold.size(); li++) + { + if (pl[i].isReference()) + { + DataObjectPtr ref = findReference(oldDO, newDO, dolold[li]); + if (ref) + { + dolnew.setDataObject(li, ref); + } + } + else { - DataObjectPtr dob = dataObject->getDataObject(pl[i]); - newob->setDataObject(pl[i],internalCopy(dob,true)); + findReferences(oldDO, newDO, dolold[li], dolnew[li]); } } } else { - if (pl[i].isMany()) + if (pl[i].isReference()) { - DataObjectList& dolold = dataObject->getList(pl[i]); - DataObjectList& dolnew = newob->getList(pl[i]); - transferlist(dolnew,dolold, pl[i].getTypeEnum()); + DataObjectPtr ref = findReference(oldDO, newDO, obj->getDataObject(pl[i])); + if (ref) + { + newObj->setDataObject(pl[i], ref); + } } - else + else { - transferitem(newob,dataObject, pl[i]); + findReferences(oldDO, newDO, obj->getDataObject(pl[i]), newObj->getDataObject(pl[i])); } - } // else - } - } - return newob; + } + } + } + } + + DataObjectPtr CopyHelper::findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref) + { + SDOString rootXPath = oldDO->objectToXPath(); + SDOString refXPath = ref->objectToXPath(); + + DataObjectPtr newRef; + if (refXPath.find(refXPath) == 0) + { + SDOString relXPath = refXPath.substr(rootXPath.length()); + if (relXPath == "") + newRef = newDO; + if (relXPath.find("/") == 0) + relXPath = relXPath.substr(1); + newRef = newDO->getDataObject(relXPath); + } + + return newRef; } - + } }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/CopyHelper.h?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/CopyHelper.h diff -u pecl/sdo/commonj/sdo/CopyHelper.h:1.5 pecl/sdo/commonj/sdo/CopyHelper.h:1.5.2.1 --- pecl/sdo/commonj/sdo/CopyHelper.h:1.5 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/CopyHelper.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _COPYHELPER_H_ #define _COPYHELPER_H_ @@ -62,7 +62,12 @@ private: static void transferlist(DataObjectList& to, DataObjectList& from, Type::Types t); static void transferitem(DataObjectPtr to, DataObjectPtr from, const Property& p); + static void transfersequenceitem(Sequence *to, Sequence *from, const Property& p, int index); + static DataObjectPtr internalCopy(DataObjectPtr dataObject, bool fullCopy); + static void resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO); + static void findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr obj, DataObjectPtr newObj); + static DataObjectPtr findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.cpp?r1=1.13&r2=1.13.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.cpp diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13.2.1 --- pecl/sdo/commonj/sdo/DataFactoryImpl.cpp:1.13 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:23:05 $ */ ////////////////////////////////////////////////////////////////////// // DataFactoryImpl.cpp: implementation of the DataFactory class. @@ -98,7 +98,7 @@ } } - rootElementName.erase(); + rootElementName.erase(); } @@ -166,7 +166,7 @@ if ((typeIter->second)->getAliasCount() > 0) { - for (int j=0;j<(typeIter->second)->getAliasCount();j++) + for (unsigned int j=0;j<(typeIter->second)->getAliasCount();j++) { (typeIter2->second)->setAlias( (typeIter->second)->getAlias()); @@ -176,7 +176,7 @@ // Now add all the properties PropertyList props = typeIter->second->getProperties(); - for (int i=0; i < props.size(); i++) + for (unsigned int i=0; i < props.size(); i++) { // Ensure the properties type is added const Type& propType = props[i].getType(); @@ -200,7 +200,7 @@ getPropertyImpl(props[i].getName()); if (p != 0) { - for (int j=0;j<p->getAliasCount();j++) + for (unsigned int j=0;j<p->getAliasCount();j++) { p->setAlias(props[i].getAlias(j)); } @@ -267,7 +267,7 @@ bool isData, bool isFromList) { - addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); + addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList); } // =================================================================== @@ -286,7 +286,7 @@ PropertyList pl = cs->getProperties(); - for (int i=0 ; i < pl.size() ; i++ ) + for (unsigned int i=0 ; i < pl.size() ; i++ ) { if (recursiveCheck((TypeImpl*)&(pl[i].getType()), t)) return true; } @@ -309,7 +309,7 @@ } if (cstypes.size() > 0) { - for (int i = 0 ;i < cstypes.size(); i++) + for (unsigned int i = 0 ;i < cstypes.size(); i++) { if (recursiveCheck(cstypes[i], t)) { @@ -724,7 +724,7 @@ const Type& DataFactoryImpl::getType(const SDOString& uri, const SDOString& inTypeName) const { - return getType(uri.c_str(), inTypeName.c_str()); + return getType(uri.c_str(), inTypeName.c_str()); } // =================================================================== @@ -778,16 +778,16 @@ } void DataFactoryImpl::setBaseType(const SDOString& typeuri, - const SDOString& typenam, - const SDOString& baseuri, - const SDOString& basename, - bool isRestriction) -{ - setBaseType(typeuri.c_str(), - typenam.c_str(), - baseuri.c_str(), - basename.c_str(), - isRestriction); + const SDOString& typenam, + const SDOString& baseuri, + const SDOString& basename, + bool isRestriction) +{ + setBaseType(typeuri.c_str(), + typenam.c_str(), + baseuri.c_str(), + basename.c_str(), + isRestriction); } @@ -1302,7 +1302,7 @@ const SDOString& typenam, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str()); } // =================================================================== @@ -1325,7 +1325,7 @@ const SDOString& propname, const SDOString& alias) { - setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); + setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str()); } // =================================================================== @@ -1651,67 +1651,6 @@ return getDASValue(typeuri.c_str(), typenam.c_str(), propertyName.c_str(), name.c_str()); } -bool DataFactoryImpl::compareTypes(const TypeImpl* t1, const Type& t2) -{ - PropertyList pl = t2.getProperties(); - for (int i=0;i<pl.size();i++) - { - PropertyImpl* p = t1->getPropertyImpl(i); - if (p == 0) return false; - if (p->isMany() != pl[i].isMany()) return false; - if (p->isContainment() != pl[i].isContainment()) return false; - if (strcmp( p->getType().getURI(), - pl[i].getType().getURI())) return false; - if (strcmp( p->getType().getName(), - pl[i].getType().getName())) return false; - } - return true; - -} -bool DataFactoryImpl::checkType(const Type& t) -{ - const TypeImpl* t2 = findTypeImpl(t.getURI(), - t.getName()); - - if (t2 == 0) return false; - - if (!compareTypes(t2,t)) return false; - - PropertyList pl = t.getProperties(); - for (int i=0;i<pl.size();i++) - { - if (pl[i].getType().isDataObjectType()) - { - if (!checkType(pl[i].getType())) return false; - } - } - return true; -} - - -// only checks the tree dirctly descended from this object if the -// object is specified, otherwise validates the whole factory - -bool DataFactoryImpl::isCompatible(DataFactory* df, DataObject* d) -{ - if (d == 0) - { - TypeList tl = df->getTypes(); - for (int j=0;j<tl.size();j++) - { - const TypeImpl* t = findTypeImpl(tl[j].getURI(), - tl[j].getName()); - - if (t == 0) return false; - if (!compareTypes(t,tl[j]))return false; - } - return true; - } - else - { - return checkType(d->getType()); - } -} bool DataFactoryImpl::generateInterface(const char* fileroot, const char* factoryname) { @@ -1776,7 +1715,7 @@ fprintf(header," * Forward declarations and smart pointers *\n"); fprintf(header," *******************************************/\n\n\n"); - int i; + unsigned int i; for (i=0;i<tl.size();i++) { nscount = 0; @@ -1846,7 +1785,7 @@ { the_uri = new char[2 * strlen(uri) + 1]; int jj=0; - for (int ii=0;ii<strlen(uri);ii++) + for (unsigned int ii=0;ii<strlen(uri);ii++) { if (uri[ii] == '.') { @@ -1949,7 +1888,7 @@ PropertyList pl = tl[i].getProperties(); - for (int j=0;j<pl.size();j++) + for (unsigned int j=0;j<pl.size();j++) { const char* pname = pl[j].getName(); @@ -2176,7 +2115,7 @@ bool DataFactoryImpl::generateInterface(const SDOString& fileroot, const SDOString& factoryname) { - return generateInterface(fileroot.c_str(), factoryname.c_str()); + return generateInterface(fileroot.c_str(), factoryname.c_str()); } std::ostream& DataFactoryImpl::printSelf(std::ostream &os) http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataFactoryImpl.h?r1=1.9&r2=1.9.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataFactoryImpl.h diff -u pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9.2.1 --- pecl/sdo/commonj/sdo/DataFactoryImpl.h:1.9 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataFactoryImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 472054 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _DataFactoryIMPL_H_ #define _DataFactoryIMPL_H_ @@ -663,9 +663,6 @@ virtual const TypeImpl& getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const; virtual const SDOString& getRootElementName() const; virtual void setRootElementName(const SDOString& ren); - virtual bool checkType(const Type& t); - virtual bool isCompatible(DataFactory* df, DataObject* d); - virtual bool compareTypes(const TypeImpl* t1, const Type& t2); virtual bool generateInterface(const char* fileroot, const char* factoryname); virtual bool generateInterface(const SDOString& fileroot, const SDOString& factoryname); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.cpp?r1=1.14&r2=1.14.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14.2.1 --- pecl/sdo/commonj/sdo/DataObjectImpl.cpp:1.14 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478191 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/DataObjectImpl.h" @@ -944,8 +944,9 @@ void DataObjectImpl::undefineProperty(unsigned int index) { - int point = index - openBase; - if (point < 0 || point >= openProperties.size()) return; + if (index < openBase) return; + unsigned int point = index - openBase; + if (point >= openProperties.size()) return; // downgrade all the property settings above this one @@ -967,7 +968,7 @@ std::list<PropertyImpl>::iterator it = openProperties.begin(); - for (int i=0;i<point;i++)++it; /* there must be a better way */ + for (unsigned int i=0;i<point;i++)++it; /* there must be a better way */ DataFactory* df = factory; ((DataFactoryImpl*)df)->removeOpenProperty((*it).getName()); @@ -1510,7 +1511,7 @@ } } - int propIndex = getPropertyIndex(p); + int propIndex = getPropertyIndexInternal(p); DataObjectImpl* d = getDataObjectImpl(propIndex); if (d == 0) { // There is no list yet, so we need to create an @@ -1563,7 +1564,7 @@ { PropertyList props = getType().getProperties(); - for (int i = 0; i < props.size() ; ++i) + for (unsigned int i = 0; i < props.size() ; ++i) { if (!strcmp(props[i].getName(),p.getName()) ) { @@ -1591,43 +1592,56 @@ } /** - * This method is used internally to find the index of a - * property. If differs from the public getPropertyIndex method - * in that if the type of the containing object is open a new - * index is created. In the public version and error is thrown - */ + * This method is used internally to find the index of a + * property. If differs from the public getPropertyIndex method + * in that if the type of the containing object is open a new + * index is created. In the public version and error is thrown + */ unsigned int DataObjectImpl::getPropertyIndexInternal(const Property& p) { - unsigned int index; + unsigned int index; - try - { + try + { index = getPropertyIndex(p); - } - catch ( SDOPropertyNotFoundException e ) - { - // this could mean that this data object has an open - // type. getPropertyIndex fails in this case because it - // tries to access the index of the property - // and it doesn't exist because it hasn't been created yet. - // This new method is used where properties are being set - // based on existing property objects. This is like to - // occur when a data object is being copied. In this case - // we want properties that are open to be copied also - // so we need to create the property and provide the index - if ( this->getType().isOpenType() ) - { - const Property *prop = defineProperty(p.getName(), p.getType()); - index = getPropertyIndex(p); - } - else - { - throw e; - } - } + } + catch ( SDOPropertyNotFoundException e ) + { + // this could mean that this data object has an open + // type. getPropertyIndex fails in this case because it + // tries to access the index of the property + // and it doesn't exist because it hasn't been created yet. + // This new method is used where properties are being set + // based on existing property objects. This is likely to + // occur when a data object is being copied. In this case + // we want properties that are open to be copied also + // so we need to create the property and provide the index + if ( this->getType().isOpenType() ) + { + const Property *prop = NULL; + + // need to treat many valued properties specially + // because the property is a list rather than + // a single value + if ( p.isMany() ) + { + prop = defineList(p.getName()); + } + else + { + prop = defineProperty(p.getName(), p.getType()); + } + + index = getPropertyIndex(p); + } + else + { + throw e; + } + } - return index; - } + return index; + } const Property& DataObjectImpl::getProperty(unsigned int index) @@ -1672,7 +1686,7 @@ if (index >= openBase && index - openBase < openProperties.size()) { std::list<PropertyImpl>::iterator j; - int val = 0; + unsigned int val = 0; j = openProperties.begin(); while (val < index-openBase && j != openProperties.end()) { @@ -1703,7 +1717,7 @@ s = new char[strlen(path)+1]; - for (int i=0;i < strlen(path); i++) + for (unsigned int i=0;i < strlen(path); i++) { if (strchr(templateString,path[i]) != 0) { s[pos++] = path[i]; @@ -1783,7 +1797,7 @@ if (eq == string::npos) { // There is no "=" sign - int val = atoi(breakerStr.c_str()); + unsigned int val = atoi(breakerStr.c_str()); DataObjectList& list = getList(p); // The spec says that depts[1] is the first element, as is depts.0 @@ -1807,7 +1821,7 @@ // eq is now propval DataObjectList& list = getList(p); - for (int li = 0 ; li < list.size() ; ++li) + for (unsigned int li = 0 ; li < list.size() ; ++li) { // TODO comparison for double not ok @@ -2064,7 +2078,7 @@ { std::vector<PropertyImpl*> theVec; PropertyList propList = getType().getProperties(); - for (int i = 0 ; i < propList.size() ; ++i) + for (unsigned int i = 0 ; i < propList.size() ; ++i) { Property& p = propList[i]; theVec.insert(theVec.end(),(PropertyImpl*)&p); @@ -2263,13 +2277,16 @@ if (p->isMany()) { DataObjectList& dol = d->getList((Property&)*p); - long index; - DataObjectImpl* dx = d->findDataObject(prop,&index); + long idx; + DataObjectImpl* dx = d->findDataObject(prop,&idx); + // fix this. This is the only place the 2nd parm to findDataObject + // is used. Need a better way to do this + unsigned int index = (unsigned int)idx; if (index >= 0) { if(index < dol.size()) { - dol.setDataObject((unsigned int)index,value); + dol.setDataObject(index,value); } else { @@ -2319,48 +2336,6 @@ } } - void DataObjectImpl::transferChildren(DataObject* d, DataFactory* f) - { - bool isData = false; - PropertyList pl = d->getInstanceProperties(); - for (int i=0;i<pl.size();i++) - { - // even primitives need their DF fixed up - if (pl[i].getType().isDataType()) - { - isData = true; - } - - if (!d->isSet(pl[i]) || d->isNull(pl[i])) - { - continue; - } - if (pl[i].isMany()) - { - DataObjectList& dl = d->getList(pl[i]); - for (int j=0;j<dl.size();j++) - { - - DataObject* d2 = dl[j]; - if (d2) { - ((DataObjectImpl*)d2)->setDataFactory(f); - if (!isData)transferChildren(d2,f); - } - } - } - else - { - DataObject* d3 = d->getDataObject(pl[i]); - if (d3) - { - ((DataObjectImpl*)d3)->setDataFactory(f); - if (!isData)transferChildren(d3,f); - } - } - } - } - - void DataObjectImpl::checkFactory(DataObjectPtr dob, unsigned int propertyIndex) @@ -2370,13 +2345,6 @@ if (d->getDataFactory() == getDataFactory()) return; - // Temporary alteration to test the feasibility and - // problems associated with allowing data object 'migration' - // lets move this one and all its children to the factory of the - // new parent if the factories are compatible. - - DataFactoryImpl* f = (DataFactoryImpl*)getDataFactory(); - if (d->getContainer() != 0) { string msg("Insertion of object from another factory is only allowed if the parent is null: "); @@ -2394,29 +2362,6 @@ msg.c_str()); } - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(getDataFactory()); - transferChildren(d,getDataFactory()); - return; - } - - - // This is the default position.... - - string msg("Insertion from incompatible factory "); - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += getProperty(propertyIndex).getName(); - msg += " of "; - msg += getType().getURI(); - msg += "#"; - msg += getType().getName(); - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); } @@ -2445,7 +2390,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -3116,7 +3061,7 @@ if (prop.isMany()) { DataObjectList& dol = ((*i).second)->getList(); - for (int j=0;j< dol.size(); j++) + for (unsigned int j=0;j< dol.size(); j++) { if (dol[j] == indol) { @@ -3192,7 +3137,7 @@ if (getProperty((*i).first).isMany()) { DataObjectList& dl = ((*i).second)->getList(); - for (int j = 0 ; j < dl.size(); j++) + for (unsigned int j = 0 ; j < dl.size(); j++) { if (dl[j] == ob) { @@ -3748,7 +3693,7 @@ { LOGINFO_1(INFO,"ChangeSummary:Unsetting a reference to %s",prop.getName()); - for (int i=0;i< refs.size();i++) + for (unsigned int i=0;i< refs.size();i++) { if (refs[i]->getDataObject() == dol) { @@ -3765,7 +3710,7 @@ void DataObjectImpl::clearReferences() { - for (int i=0;i<refs.size();i++) + for (unsigned int i=0;i<refs.size();i++) { // Note - no loop as the referer must be of type reference refs[i]->getDataObject()->unset(refs[i]->getProperty()); @@ -3789,7 +3734,7 @@ if (p.isMany()) { DataObjectList& dol = dob->getList(p); - for (int i=0;i<dol.size();i++) + for (unsigned int i=0;i<dol.size();i++) { if (dol[i] == thisob) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectImpl.h?r1=1.12&r2=1.12.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12.2.1 --- pecl/sdo/commonj/sdo/DataObjectImpl.h:1.12 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477820 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _DATAOBJECTIMPL_H_ #define _DATAOBJECTIMPL_H_ @@ -591,7 +591,6 @@ virtual const PropertyImpl* defineList(const char* propname); virtual void undefineProperty(unsigned int index); virtual const TypeImpl& getTypeImpl(); - virtual void transferChildren(DataObject* d, DataFactory* f); virtual void setDataFactory(DataFactory *df); virtual std::ostream& printSelf(std::ostream &os); @@ -662,7 +661,7 @@ // Support for open types - int openBase; + unsigned int openBase; std::list<PropertyImpl> openProperties; static const char* emptyString; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectList.h?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectList.h diff -u pecl/sdo/commonj/sdo/DataObjectList.h:1.7 pecl/sdo/commonj/sdo/DataObjectList.h:1.7.2.1 --- pecl/sdo/commonj/sdo/DataObjectList.h:1.7 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectList.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _DATAOBJECTLIST_H_ #define _DATAOBJECTLIST_H_ @@ -55,15 +55,15 @@ * with their correct type using the list getInteger(index) api. */ - virtual SDO_API DataObjectPtr operator[] (int pos) = 0; - virtual SDO_API const DataObjectPtr operator[] (int pos) const = 0; + virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0; + virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0; /** size returns the number of elements. * * The size method returns the number of elements in the list */ - virtual SDO_API int size () const = 0; + virtual SDO_API unsigned int size () const = 0; /** getBoolean returns a boolean at an index * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.cpp?r1=1.11&r2=1.11.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.cpp diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11.2.1 --- pecl/sdo/commonj/sdo/DataObjectListImpl.cpp:1.11 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 483416 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/DataObjectListImpl.h" @@ -140,13 +140,13 @@ } } -RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) +RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) { validateIndex(pos); return plist[pos]; } -const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (int pos) const +const RefCountingPointer<DataObject> DataObjectListImpl::operator[] (unsigned int pos) const { validateIndex(pos); RefCountingPointer<DataObjectImpl> d = plist[pos]; @@ -155,7 +155,7 @@ } -int DataObjectListImpl::size () const +unsigned int DataObjectListImpl::size () const { return plist.size(); } @@ -203,7 +203,7 @@ { container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -280,13 +280,6 @@ if (d->getDataFactory() == theFactory) return; - // temporary experiment with allowing data objects - // to move from factory to factory if the type is - // nominally present, and the type systems match - - DataFactoryImpl* f = (DataFactoryImpl*)theFactory; - - if (d->getContainer() != 0) { std::string msg("Insertion of object into list from another factory is only allowed if the parent is null: "); @@ -304,31 +297,6 @@ SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, msg.c_str()); } - - if (f->isCompatible(d->getDataFactory(),d)) - { - d->setDataFactory(theFactory); - // we will also need to transfer any children - assuming they - // are ok in the new factory!! - d->transferChildren(d,theFactory); - return; - } - - std::string msg("Insertion into list from incompatible factory:"); - - const Type& t = d->getType(); - msg += t.getURI(); - msg += "#"; - msg += t.getName(); - msg += " into property "; - msg += container->getProperty(pindex).getName(); - msg += " of type "; - msg += typeURI; - msg += "#"; - msg += typeName; - SDO_THROW_EXCEPTION("checkFactory", SDOInvalidConversionException, - msg.c_str()); - } @@ -355,7 +323,7 @@ if (pi != 0) { unsigned int subcount = pi->getSubstitutionCount(); - for (int i=0;i<subcount;i++) + for (unsigned int i=0;i<subcount;i++) { const Type* tsub = pi->getSubstitutionType(i); if (tsub != 0 && tsub->equals(objectType)) return; @@ -438,7 +406,7 @@ container->logChange(pindex); } - for (int i=0;i < plist.size(); i++) + for (unsigned int i=0;i < plist.size(); i++) { if (plist[i] == d) { @@ -619,7 +587,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -630,7 +598,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -642,7 +610,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -654,7 +622,7 @@ { if (theFactory == 0) return; - if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral); + if (typeUnset)setType(Type::SDOTypeNamespaceURI, StringLiteral); RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName); DataObject* dob = dol; @@ -841,7 +809,7 @@ return d; } -void DataObjectListImpl::validateIndex(int index) const +void DataObjectListImpl::validateIndex(unsigned int index) const { if ((index < 0) || (index >= size())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/DataObjectListImpl.h?r1=1.8&r2=1.8.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/DataObjectListImpl.h diff -u pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8.2.1 --- pecl/sdo/commonj/sdo/DataObjectListImpl.h:1.8 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/DataObjectListImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _DATAOBJECTLISTIMPL_H_ #define _DATAOBJECTLISTIMPL_H_ @@ -62,8 +62,8 @@ // open type support virtual void decrementPindex(); - virtual DataObjectPtr operator[] (int pos); - virtual const DataObjectPtr operator[] (int pos) const; + virtual DataObjectPtr operator[] (unsigned int pos); + virtual const DataObjectPtr operator[] (unsigned int pos) const; // set/get primitive values virtual bool getBoolean(unsigned int index) const; @@ -99,7 +99,7 @@ virtual unsigned int getLength(unsigned int index) const; - virtual int size () const; + virtual unsigned int size () const; virtual void insert (unsigned int index, DataObjectPtr d); virtual void append (DataObjectPtr d); @@ -192,7 +192,7 @@ unsigned int pindex; bool isReference; - void validateIndex(int index) const; + void validateIndex(unsigned int index) const; static const SDOString BooleanLiteral; static const SDOString ByteLiteral; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/EqualityHelper.cpp?r1=1.6&r2=1.6.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/EqualityHelper.cpp diff -u pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6.2.1 --- pecl/sdo/commonj/sdo/EqualityHelper.cpp:1.6 Fri Nov 24 10:44:26 2006 +++ pecl/sdo/commonj/sdo/EqualityHelper.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:26 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/Property.h" #include "commonj/sdo/Type.h" @@ -69,7 +69,7 @@ wchar_t * buft = new wchar_t[siz]; from->getString(p, buff, siz); to->getString(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -94,7 +94,7 @@ char * buft = new char[siz]; from->getBytes(p, buff, siz); to->getBytes(p, buft, siz); - for (int i=0;i< siz; i++) + for (unsigned int i=0;i< siz; i++) { if (buff[i] != buft[i]) { @@ -119,7 +119,7 @@ { case Type::BooleanType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getBoolean(i) != from.getBoolean(i)) { @@ -131,7 +131,7 @@ case Type::ByteType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getByte(i) != from.getByte(i)) { @@ -143,7 +143,7 @@ case Type::CharacterType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getCharacter(i) != from.getCharacter(i)) { @@ -155,7 +155,7 @@ case Type::IntegerType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getInteger(i) != from.getInteger(i)) { @@ -167,7 +167,7 @@ case Type::ShortType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getShort(i) != from.getShort(i)) { @@ -178,7 +178,7 @@ } case Type::DoubleType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDouble(i) != from.getDouble(i)) { @@ -190,7 +190,7 @@ case Type::FloatType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getFloat(i) != from.getFloat(i)) { @@ -202,7 +202,7 @@ case Type::LongType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getLong(i) != from.getLong(i)) { @@ -214,7 +214,7 @@ case Type::DateType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { if (to.getDate(i).getTime() != from.getDate(i).getTime()) { @@ -229,7 +229,7 @@ case Type::UriType: case Type::StringType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -240,7 +240,7 @@ wchar_t * buft = new wchar_t[siz]; from.getString(i,buff,siz); to.getString(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -258,7 +258,7 @@ case Type::BytesType: { - for (int i=0;i< from.size(); i++) + for (unsigned int i=0;i< from.size(); i++) { unsigned int siz = from.getLength(i); if (siz != to.getLength(i)) return false; @@ -269,7 +269,7 @@ char * buft = new char[siz]; from.getBytes(i,buff,siz); to.getBytes(i,buft,siz); - for (int j=0;j<siz;j++) + for (unsigned int j=0;j<siz;j++) { if (buff[j] != buft[j]) { @@ -310,7 +310,7 @@ PropertyList pl = dataObject1->getInstanceProperties(); - for (int i=0;i < pl.size(); i++) + for (unsigned int i=0;i < pl.size(); i++) { // data objects are only compared the deep equality case if (pl[i].getType().isDataObjectType()) @@ -327,7 +327,7 @@ DataObjectList& dolnew = dataObject2->getList(pl[i]); if (dolnew.size() != dolold.size()) return false; - for (int i=0;i< dolold.size(); i++) + for (unsigned int i=0;i< dolold.size(); i++) { if (!internalEqual(dolold[i], dolnew[i], true)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.cpp?r1=1.6&r2=1.6.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.cpp diff -u pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6.2.1 --- pecl/sdo/commonj/sdo/PropertyDefinition.cpp:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/PropertyDefinition.h" #include "commonj/sdo/PropertyDefinitionImpl.h" @@ -105,7 +105,7 @@ return propertydefinition->substituteNames.size(); } - const char* PropertyDefinition::getSubstituteNames(int index) const + const char* PropertyDefinition::getSubstituteNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteNames.size()) { @@ -114,7 +114,7 @@ return 0; } - const char* PropertyDefinition::getSubstituteLocalNames(int index) const + const char* PropertyDefinition::getSubstituteLocalNames(unsigned int index) const { if (index >= 0 && index < propertydefinition->substituteLocalNames.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyDefinition.h?r1=1.6&r2=1.6.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyDefinition.h diff -u pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6.2.1 --- pecl/sdo/commonj/sdo/PropertyDefinition.h:1.6 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyDefinition.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _PROPERTYDefinition_H_ #define _PROPERTYDefinition_H_ @@ -73,8 +73,8 @@ /*SDO_API*/ void addSubstitute(const SDOString& name, const SDOString& localname); /*SDO_API*/ int getSubstituteCount() const; - /*SDO_API*/ const char* getSubstituteNames(int index) const; - /*SDO_API*/ const char* getSubstituteLocalNames(int index) const; + /*SDO_API*/ const char* getSubstituteNames(unsigned int index) const; + /*SDO_API*/ const char* getSubstituteLocalNames(unsigned int index) const; /*SDO_API*/ void setAliases(const char* aliases); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyImpl.cpp?r1=1.10&r2=1.10.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyImpl.cpp diff -u pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10.2.1 --- pecl/sdo/commonj/sdo/PropertyImpl.cpp:1.10 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,16 +17,13 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 482678 $ $Date: 2006/12/07 12:23:05 $ */ + +#include "commonj/sdo/export.h" #include <iostream> using namespace std; -#ifndef SDO_EXPORTS -#define SDO_EXPORTS -#endif -#include "commonj/sdo/export.h" - #include "commonj/sdo/Sequence.h" #include "commonj/sdo/DataObject.h" @@ -266,7 +263,7 @@ /////////////////////////////////////////////////////////////////////////// const Type* PropertyImpl::getSubstitutionType(const char* inname) const { - for (int i=0;i<substitutions.size();i++) + for (unsigned int i=0;i<substitutions.size();i++) { if (!strcmp(inname, substitutions[i].name.c_str())) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.cpp?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.cpp diff -u pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 pecl/sdo/commonj/sdo/PropertyList.cpp:1.5.2.1 --- pecl/sdo/commonj/sdo/PropertyList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -74,7 +74,7 @@ return *(plist[pos]); } -SDO_API int PropertyList::size () +SDO_API unsigned int PropertyList::size () { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertyList.h?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/PropertyList.h diff -u pecl/sdo/commonj/sdo/PropertyList.h:1.5 pecl/sdo/commonj/sdo/PropertyList.h:1.5.2.1 --- pecl/sdo/commonj/sdo/PropertyList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/PropertyList.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _PROPERTYLIST_H_ #define _PROPERTYLIST_H_ @@ -71,7 +71,7 @@ * size() returns the number of elements in the list. */ - SDO_API int size (); + SDO_API unsigned int size (); /** insert adds an element to the list * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.cpp?r1=1.6.2.1&r2=1.6.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.cpp diff -u pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6.2.1 pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6.2.2 --- pecl/sdo/commonj/sdo/PropertySetting.cpp:1.6.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/PropertySetting.h" #include "SDOString.h" http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/PropertySetting.h?r1=1.6.2.1&r2=1.6.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/PropertySetting.h diff -u pecl/sdo/commonj/sdo/PropertySetting.h:1.6.2.1 pecl/sdo/commonj/sdo/PropertySetting.h:1.6.2.2 --- pecl/sdo/commonj/sdo/PropertySetting.h:1.6.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/PropertySetting.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _PROPERTYSETTING_H_ #define _PROPERTYSETTING_H_ http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Attributes.cpp?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Attributes.cpp diff -u pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5.2.1 --- pecl/sdo/commonj/sdo/SAX2Attributes.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SAX2Attributes.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SAX2Attributes.h" @@ -61,7 +61,7 @@ const SAX2Attribute* SAX2Attributes::getAttribute(const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { @@ -73,7 +73,7 @@ void SAX2Attributes::addAttribute(const SAX2Attribute& attr) { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equals(attr.getUri())) { @@ -95,7 +95,7 @@ const SDOXMLString& attributeUri, const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getUri().equalsIgnoreCase(attributeUri)) { @@ -112,7 +112,7 @@ const SDOXMLString& SAX2Attributes::getValue( const SDOXMLString& attributeName) const { - for (int i=0; i < attributes.size(); i++) + for (unsigned int i=0; i < attributes.size(); i++) { if (attributes[i].getName().equalsIgnoreCase(attributeName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SAX2Parser.cpp?r1=1.6.2.1&r2=1.6.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/SAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6.2.1 pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6.2.2 --- pecl/sdo/commonj/sdo/SAX2Parser.cpp:1.6.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/SAX2Parser.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SAX2Parser.h" #include "libxml/SAX2.h" @@ -500,7 +500,7 @@ ctxt = xmlCreatePushParserCtxt(handler, this, bctx, bcount, NULL); - for (int i=0;i<buffer_vec.size();i++) + for (unsigned int i=0;i<buffer_vec.size();i++) { if (buffer_vec[i].len > 0) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp?r1=1.8.2.1&r2=1.8.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8.2.1 pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8.2.2 --- pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp:1.8.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/SDOSAX2Parser.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOSAX2Parser.h" @@ -1467,7 +1467,7 @@ */ PropertyList pl = type.getProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { XSDPropertyInfo* pi = (XSDPropertyInfo*)((DASProperty*)&pl[i])->getDASValue("XMLDAS::PropertyInfo"); if (pi) @@ -1476,7 +1476,7 @@ if (localName .equals(propdef.localname)) return propdef.name; - for (int j=0;j< propdef.substituteNames.size();j++) + for (unsigned int j=0;j< propdef.substituteNames.size();j++) { if (propdef.substituteLocalNames[j].equals(localName)) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp?r1=1.12&r2=1.12.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp diff -u pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12.2.1 --- pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp:1.12 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOSchemaSAX2Parser.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 478193 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 483102 $ $Date: 2006/12/07 12:23:05 $ */ #include "libxml/uri.h" #include "commonj/sdo/SDOSchemaSAX2Parser.h" @@ -94,7 +94,7 @@ bool isGroup, const SAX2Attributes& groupAttributes) { - for (int i=0;i< groupList.size(); i++) + for (unsigned int i=0;i< groupList.size(); i++) { if (groupList[i].isAttributeGroup != isGroup) { @@ -117,7 +117,7 @@ int level = 0; - for (int j=0;j< groupList[i].events.size();j++) + for (unsigned int j=0;j< groupList[i].events.size();j++) { if (groupList[i].events[j].isStartEvent) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.cpp?r1=1.5.2.1&r2=1.5.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.cpp diff -u pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5.2.1 pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5.2.2 --- pecl/sdo/commonj/sdo/SDOUtils.cpp:1.5.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 483011 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOUtils.h" #include <stdio.h> @@ -123,7 +123,7 @@ void SDOUtils::printTabs(ostream& out, unsigned int incr) { - for (int ind=0; ind < incr; ind++) + for (unsigned int ind=0; ind < incr; ind++) { out << " "; } @@ -160,7 +160,7 @@ // Iterate over all the properties ////////////////////////////////////////////////////////////// PropertyList pl = dataObject->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { printTabs(out, incr); out << "Property: " << pl[i].getName() << endl; @@ -184,7 +184,7 @@ incr++; DataObjectList& dol = dataObject->getList(pl[i]); char cc[20]; - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { printTabs(out, incr); // seems to be a bug in ostream? Will not print j @@ -194,7 +194,15 @@ out << cc; out << endl; incr++; - printDataObject(out, dol[j],incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dol[j]->objectToXPath() <<endl; + } + else + { + printDataObject(out, dol[j],incr); + } incr--; out << endl; } @@ -217,7 +225,15 @@ else { incr++; - printDataObject(out, dataObject->getDataObject(pl[i]),incr); + if (pl[i].isReference()) + { + printTabs(out, incr); + out << "Reference Value: " << dataObject->getDataObject(pl[i])->objectToXPath() <<endl; + } + else + { + printDataObject(out, dataObject->getDataObject(pl[i]),incr); + } incr--; } } @@ -236,13 +252,13 @@ void SDOUtils::printTypes(std::ostream& out, DataFactoryPtr df) { TypeList tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { out << "Type: " << tl[i].getURI()<< "#" << tl[i].getName() << " isOpen: " << tl[i].isOpenType() << " isSequenced: " << tl[i].isSequencedType() << endl; PropertyList pl = tl[i].getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { out << "\tProperty: " << pl[j].getName() << " type: " <<pl[j].getType().getURI()<<"#"<<pl[j].getType().getName()<< http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOUtils.h?r1=1.5.2.1&r2=1.5.2.2&diff_format=u Index: pecl/sdo/commonj/sdo/SDOUtils.h diff -u pecl/sdo/commonj/sdo/SDOUtils.h:1.5.2.1 pecl/sdo/commonj/sdo/SDOUtils.h:1.5.2.2 --- pecl/sdo/commonj/sdo/SDOUtils.h:1.5.2.1 Mon Nov 27 09:31:52 2006 +++ pecl/sdo/commonj/sdo/SDOUtils.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/27 09:31:52 $ */ +/* $Rev: 482588 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _SDOUTILS_H_ #define _SDOUTILS_H_ http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLString.cpp?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLString.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7.2.1 --- pecl/sdo/commonj/sdo/SDOXMLString.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXMLString.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 462804 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOXMLString.h" #include <iostream> @@ -174,7 +174,7 @@ { char* newString = new char[strlen(*this)+1]; strcpy(newString, *this); - for (int i = start; (i<=(strlen(newString)) && i < length); i++) + for (unsigned int i = start; (i<=(strlen(newString)) && i < length); i++) { newString[i] = tolower(newString[i]); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXMLWriter.cpp?r1=1.9.2.2&r2=1.9.2.3&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXMLWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.9.2.2 pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.9.2.3 --- pecl/sdo/commonj/sdo/SDOXMLWriter.cpp:1.9.2.2 Fri Dec 1 15:22:49 2006 +++ pecl/sdo/commonj/sdo/SDOXMLWriter.cpp Thu Dec 7 12:23:05 2006 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 477891 $ $Date: 2006/12/01 15:22:49 $ */ +/* $Rev: 482667 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOXMLWriter.h" #include "commonj/sdo/SDOXMLString.h" @@ -38,27 +38,27 @@ { namespace sdo { - - - - + + + + SDOXMLWriter::SDOXMLWriter( DataFactoryPtr dataFact) : dataFactory(dataFact) { - + } - + SDOXMLWriter::~SDOXMLWriter() { freeWriter(); } - + void SDOXMLWriter::setWriter(xmlTextWriterPtr textWriter) { writer = textWriter; } - + void SDOXMLWriter::freeWriter() { if (writer != NULL) @@ -67,28 +67,28 @@ writer = NULL; } } - + int SDOXMLWriter::write(XMLDocumentPtr doc, int indent) { if (!doc) { return 0; } - + if (writer == NULL) { // Throw exception return -1; } - + int rc = 0; - + //namespaceUriStack.empty(); //namespaceUriStack.push(SDOXMLString()); //namespaces.empty(); //namespaceStack.push(namespaces); namespaceMap.empty(); - + if (indent >= 0) { xmlTextWriterSetIndent(writer, 1); @@ -105,7 +105,7 @@ xmlTextWriterSetIndentString(writer, SDOXMLString("")); } } - + if (doc->getXMLDeclaration()) { rc = xmlTextWriterStartDocument(writer, doc->getXMLVersion(), doc->getEncoding(), NULL); @@ -113,14 +113,14 @@ SDO_THROW_EXCEPTION("write", SDOXMLParserException, "xmlTextWriterStartDocument failed"); } } - + DataObjectPtr root = doc->getRootDataObject(); if (root) { const Type& rootType = root->getType(); SDOXMLString rootTypeURI = rootType.getURI(); SDOXMLString rootTypeName = rootType.getName(); - + // For the root DataObject we need to determine the element name SDOXMLString elementURI = doc->getRootElementURI(); if (elementURI.isNull() || elementURI.equals("")) @@ -133,7 +133,7 @@ elementName = rootTypeName; elementName = elementName.toLower(0,1); } - + // If the element name is defined as a global element then we // can supress the writing of xsi:type according to the spec bool writeXSIType = true; @@ -155,7 +155,7 @@ catch(SDORuntimeException&) { } - + // Supress the writing of xsi:type as well for DataObjects of type // commonj.sdo#OpenDataObject if (writeXSIType && @@ -171,10 +171,10 @@ SDO_THROW_EXCEPTION("write", SDOXMLParserException, "xmlTextWriterEndDocument failed"); return rc; } - + xmlTextWriterFlush(writer); freeWriter(); - + return rc; } @@ -183,13 +183,13 @@ ////////////////////////////////////////////////////////////////////////// void SDOXMLWriter::handleChangeSummaryAttributes( - ChangeSummaryPtr cs, + ChangeSummaryPtr cs, DataObjectPtr dol) { int rc; SettingList& sl = cs->getOldValues(dol); - if (sl.size() == 0) + if (sl.size() == 0) { // no attributes return; @@ -198,40 +198,40 @@ { try { - if (sl.get(j)->getProperty().isMany()) + if (sl.get(j)->getProperty().isMany()) { // manys are elements continue; } - + if (sl.get(j)->getProperty().getType().isDataType()) { // data types are OK - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString(sl.get(j)->getCStringValue())); } - else + else { DataObjectPtr dob = sl.get(j)->getDataObjectValue(); - if (dob) + if (dob) { if (cs->isDeleted(dob)) { - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString(cs->getOldXpath(dob))); } - else + else { - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString(dob->objectToXPath())); } } else { - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString("")); } @@ -247,29 +247,29 @@ ////////////////////////////////////////////////////////////////////////// // Write Change Summary elements ////////////////////////////////////////////////////////////////////////// - + void SDOXMLWriter::handleChangeSummaryElements( - ChangeSummaryPtr cs, + ChangeSummaryPtr cs, DataObjectPtr dob) { int rc; SettingList& sl = cs->getOldValues(dob); - - if (sl.size() == 0) + + if (sl.size() == 0) { // there are no setting for this element. return; } - + for (int j=0;j< sl.size(); j++) { - try + try { // single values will have been covered by the attributes. if (!sl.get(j)->getProperty().isMany()) continue; - + if (sl.get(j)->getProperty().getType().isDataType()) { @@ -277,12 +277,12 @@ writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString(sl.get(j)->getCStringValue())); - + } // if datatype else { DataObjectPtr dob2 = sl.get(j)->getDataObjectValue(); - if (!dob2) + if (!dob2) { continue; } @@ -302,14 +302,14 @@ rc = xmlTextWriterEndElement( writer); } - } + } } catch (SDORuntimeException e) { // ignore this element } } // for - } + } ////////////////////////////////////////////////////////////////////////// @@ -317,42 +317,42 @@ ////////////////////////////////////////////////////////////////////////// void SDOXMLWriter::handleChangeSummaryDeletedObject( - const char* name, - ChangeSummaryPtr cs, + const char* name, + ChangeSummaryPtr cs, DataObjectPtr dob) { - + int rc, k; // TODO error handling - + SettingList& sl = cs->getOldValues(dob); - + rc = xmlTextWriterStartElement( writer, SDOXMLString(name)); - if (sl.size() == 0) + if (sl.size() == 0) { - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString("sdo:ref"), SDOXMLString(cs->getOldXpath(dob))); rc = xmlTextWriterEndElement(writer); return; } - - try + + try { // print single valued datatypes as attributes - + for (int j=0;j< sl.size(); j++) { - //if (!sl.get(j)->isSet()) + //if (!sl.get(j)->isSet()) //{ // // unset properties dont need recording - ah but they do! // // continue; //} - if ( sl.get(j)->getProperty().isMany()) + if ( sl.get(j)->getProperty().isMany()) { // manys are elements continue; @@ -363,16 +363,16 @@ continue; } - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString(sl.get(j)->getProperty().getName()), SDOXMLString(sl.get(j)->getCStringValue())); } // for attributes - - - // now we are onto the many-values, + + + // now we are onto the many-values, // and dataobject single values. - // + // // handle deletions within deletions in reverse order, so they match the // deletion records above. @@ -380,7 +380,7 @@ { if ( !sl.get(k)->getProperty().getType().isDataType() && - sl.get(k)->getProperty().isMany()) + sl.get(k)->getProperty().isMany()) { // its a dataobject type DataObjectPtr dob2 = sl.get(k)->getDataObjectValue(); @@ -396,7 +396,7 @@ if ( !sl.get(k)->getProperty().getType().isDataType()) { - if (sl.get(k)->getProperty().isMany()) continue; + if (sl.get(k)->getProperty().isMany()) continue; // its a single valued dataobject type DataObjectPtr dob2 = sl.get(k)->getDataObjectValue(); @@ -406,13 +406,13 @@ getProperty().getName(),cs,dob2); } - else + else { - if ( !sl.get(k)->getProperty().isMany()) continue; - + if ( !sl.get(k)->getProperty().isMany()) continue; + // could only be many valued data type - - rc = xmlTextWriterWriteElement(writer, + + rc = xmlTextWriterWriteElement(writer, SDOXMLString(sl.get(k)->getProperty().getName()), SDOXMLString(sl.get(k)->getCStringValue())); } @@ -424,7 +424,7 @@ } rc = xmlTextWriterEndElement(writer); - } + } ////////////////////////////////////////////////////////////////////////// @@ -432,14 +432,14 @@ ////////////////////////////////////////////////////////////////////////// void SDOXMLWriter::handleSummaryChange( - const SDOXMLString& elementName, - ChangeSummaryPtr cs, + const SDOXMLString& elementName, + ChangeSummaryPtr cs, DataObjectPtr dob) { - int rc; + int rc; DataObject* temp = dob; const char* name; - try + try { name = temp->getContainmentProperty().getName(); } @@ -447,9 +447,9 @@ { // This could be a root, and have no name. name = 0; - } + } - if (name == 0) + if (name == 0) { rc = xmlTextWriterStartElement( writer, @@ -468,7 +468,7 @@ return; } - try + try { name = temp->objectToXPath(); } @@ -477,7 +477,7 @@ name = 0; } - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString("sdo:ref"), SDOXMLString(name)); @@ -497,8 +497,8 @@ const SDOXMLString& elementName, ChangeSummaryPtr cs) { - int i; - int rc; + unsigned int i; + int rc; ChangedDataObjectList& changedDOs = cs->getChangedDataObjects(); rc = xmlTextWriterStartElementNS(writer, @@ -506,7 +506,7 @@ if (rc != 0) return; if (cs->isLogging()) { - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, SDOXMLString("logging"), SDOXMLString("true")); } @@ -520,13 +520,13 @@ for (i=0;i< changedDOs.size();i++) { if (cs->isCreated(changedDOs[i]) - && changedDOs.getType(i) == ChangedDataObjectList::Create) + && changedDOs.getType(i) == ChangedDataObjectList::Create) { // TODO - should work out if theres a IDREF here // TODO - can we have more than one create like this? try { - rc = xmlTextWriterWriteElement(writer, + rc = xmlTextWriterWriteElement(writer, SDOXMLString("create"), SDOXMLString(changedDOs[i]->objectToXPath())); } @@ -536,12 +536,12 @@ } } if (cs->isDeleted(changedDOs[i]) - && changedDOs.getType(i) == ChangedDataObjectList::Delete) + && changedDOs.getType(i) == ChangedDataObjectList::Delete) { // TODO - should work out if theres a IDREF here - try + try { - rc = xmlTextWriterWriteElement(writer, + rc = xmlTextWriterWriteElement(writer, SDOXMLString("delete"), SDOXMLString(cs->getOldXpath(changedDOs[i]))); } @@ -552,7 +552,7 @@ } } - + for (i=0;i< changedDOs.size();i++) { if (cs->isModified(changedDOs[i])) @@ -560,15 +560,15 @@ handleSummaryChange(elementName, cs, changedDOs[i]); } } - + } rc = xmlTextWriterEndElement(writer); } - + ////////////////////////////////////////////////////////////////////////// // Add to namespaces ////////////////////////////////////////////////////////////////////////// - + void SDOXMLWriter::addToNamespaces(DataObjectImpl* dob) { std::map<SDOXMLString,SDOXMLString>::iterator it; @@ -587,7 +587,7 @@ } PropertyList pl = dob->getInstanceProperties(); - for (int i = 0; i < pl.size(); i++) + for (unsigned int i = 0; i < pl.size(); i++) { if (!dob->isSet(pl[i]))continue; @@ -596,7 +596,7 @@ if (!pl[i].getType().isDataType()) { DataObjectList& dl = dob->getList(pl[i]); - for (int k=0;k< dl.size() ;k++) + for (unsigned int k=0;k< dl.size() ;k++) { DataObjectImpl* d = (DataObjectImpl*)(DataObject*)dl[k]; if (d != 0)addToNamespaces(d); @@ -611,7 +611,7 @@ if (d != 0)addToNamespaces(d); } else - { + { XSDPropertyInfo* pi = getPropertyInfo(dob->getType(), pl[i]); if (pi) { @@ -619,10 +619,10 @@ propdef = pi->getPropertyDefinition(); if (propdef.isElement)continue; if (!propdef.isQName)continue; - + SDOXMLString propertyValue = (dob->getCString(pl[i])); XMLQName qname(propertyValue); - + it = namespaceMap.find(qname.getURI()); if (it == namespaceMap.end()) { @@ -636,7 +636,7 @@ } } } - + ////////////////////////////////////////////////////////////////////////// // Write xmlns:xsi= if nexessary @@ -648,7 +648,7 @@ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(xsins); if (it == namespaceMap.end()) - { + { namespaceMap.insert(make_pair( SDOXMLString("http://www.w3.org/2001/XMLSchema-instance"), SDOXMLString("xsi"))); @@ -657,11 +657,11 @@ // prefix, xsins); } } - + ////////////////////////////////////////////////////////////////////////// // Write a DatObject tree ////////////////////////////////////////////////////////////////////////// - + int SDOXMLWriter::writeDO( DataObjectPtr dataObject, const SDOXMLString& elementURI, @@ -678,12 +678,10 @@ // Don't write the element URI if the element is a child of an open type // and not one of the declared properties SDOXMLString uri = elementURI; -/* ------------------------------------ - Patch for bug 9498 - if (!isRoot && !writeXSIType) +/* if (!isRoot && !writeXSIType) { DataObject* dob = dataObject; - DataObjectImpl* cont = + DataObjectImpl* cont = ((DataObjectImpl*)dob)->getContainerImpl(); if (cont != 0) { @@ -695,9 +693,8 @@ } } } - } - Patch for bug 9498 - ------------------------------------ */ + } */ + //SDOXMLString uri; //if (!elementURI.equals(namespaceUriStack.top())) //{ @@ -714,16 +711,16 @@ { if (dataObject->isNull("")) { - rc = xmlTextWriterStartElementNS(writer, + rc = xmlTextWriterStartElementNS(writer, NULL, elementName, uri); - if (rc < 0) + if (rc < 0) { - SDO_THROW_EXCEPTION("writeDO", - SDOXMLParserException, + SDO_THROW_EXCEPTION("writeDO", + SDOXMLParserException, "xmlTextWriterStartElementNS failed"); - } - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:nil", + } + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:nil", (const unsigned char*)"true"); writeXmlnsXsi(); rc = xmlTextWriterEndElement(writer); @@ -734,7 +731,7 @@ writeXMLElement(writer, elementName, dataObject->getCString("")); - /* + /* xmlTextWriterWriteElement(writer, elementName, SDOXMLString(dataObject->getCString(""))); @@ -749,7 +746,7 @@ return 0; } - + //namespaceStack.push(namespaces); @@ -788,26 +785,26 @@ rc = xmlTextWriterStartElementNS(writer, NULL, theName, NULL); if (rc < 0) { SDO_THROW_EXCEPTION("writeDO", SDOXMLParserException, "xmlTextWriterStartElementNS failed"); - } + } } - + if (writeXSIType) { - rc = xmlTextWriterWriteAttributeNS(writer, - SDOXMLString("xsi"), SDOXMLString("type"), + rc = xmlTextWriterWriteAttributeNS(writer, + SDOXMLString("xsi"), SDOXMLString("type"), NULL, - /*SDOXMLString("http://www.w3.org/2001/XMLSchema-instance"),*/ + /*SDOXMLString("http://www.w3.org/2001/XMLSchema-instance"),*/ SDOXMLString(dataObject->getType().getName())); if (isRoot) { namespaceMap.insert(make_pair( SDOXMLString("http://www.w3.org/2001/XMLSchema-instance"), SDOXMLString("xsi"))); - + } else - { + { writeXmlnsXsi(); } } @@ -831,7 +828,7 @@ DataObjectImpl* d = (DataObjectImpl*)(DataObject*)dataObject; spacescount = 1; addToNamespaces(d); - + ///////////////////////////////////////////////////////////////////////////////////// // // build the namespace map, and write the items out at the // // top of the tree. @@ -841,7 +838,7 @@ // { // TypeList types = (d->getDataFactory())->getTypes(); // std::map<SDOXMLString,SDOXMLString>::iterator it; -// +// // for (int i = 0; i<types.size(); i++) // { // SDOXMLString uri = types[i].getURI(); @@ -850,7 +847,7 @@ // if (it == namespaceMap.end()) // { // char buf[4]; -// if (!elementURI.isNull()) +// if (!elementURI.isNull()) // { // if (elementURI.equals(uri)) // { @@ -867,7 +864,7 @@ // } // } //////////////////////////////////////////////////////////////////////////////////// - + for (it = namespaceMap.begin();it != namespaceMap.end(); ++it) { if ((*it).first.equals("")) continue; @@ -885,7 +882,7 @@ if (!writeXSIType) { DataObject* dob = dataObject; - DataObjectImpl* cont = + DataObjectImpl* cont = ((DataObjectImpl*)dob)->getContainerImpl(); if (cont != 0) { @@ -893,40 +890,44 @@ { //if (dataObject->getType().getURI() != 0) //{ - // std::string value = + // std::string value = // dataObject->getType().getURI(); // value += ":"; // value += dataObject->getType().getName(); - // rc = xmlTextWriterWriteAttribute(writer, - // (const unsigned char*)"xsi:type", + // rc = xmlTextWriterWriteAttribute(writer, + // (const unsigned char*)"xsi:type", // (const unsigned char*)value.c_str()); //} //else - //{ + //{ if (cont->getTypeImpl().getPropertyImpl(elementName) == 0) { - const SDOXMLString& typeURI = dataObject->getType().getURI(); + const SDOXMLString& typeURI = dataObject->getType().getURI(); const SDOXMLString& typeName = dataObject->getType().getName(); - SDOXMLString theName=typeName; - -/* Patch for bug9498 if (!typeURI.isNull() && !typeURI.equals(tnsURI) && !typeURI.equals("")) */ - if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) + // Supress the writing of xsi:type as well for DataObjects of type + // commonj.sdo#OpenDataObject + if (!(typeURI.equals("commonj.sdo") && typeName.equals("OpenDataObject"))) { - std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); - if (it != namespaceMap.end()) + SDOXMLString theName=typeName; + + if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals("")) { - theName = (*it).second; - theName += ":"; - theName += typeName; + std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI); + if (it != namespaceMap.end()) + { + theName = (*it).second; + theName += ":"; + theName += typeName; + } } - } - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:type", - (const unsigned char*)theName); + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:type", + (const unsigned char*)theName); - writeXmlnsXsi(); + writeXmlnsXsi(); + } } } } @@ -935,10 +936,10 @@ // write nil if required if (dataObject->isNull("")) { - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:nil", + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:nil", (const unsigned char*)"true"); - + writeXmlnsXsi(); } @@ -946,13 +947,13 @@ ////////////////////////////////////////////////////////////////////////// // Iterate over all the properties to find attributes ////////////////////////////////////////////////////////////////////////// - int i; - int j = 1; + unsigned int i; + unsigned int j = 1; PropertyList pl = dataObject->getInstanceProperties(); for (i = 0; i < pl.size(); i++) { if (dataObject->isSet(pl[i])) - { + { SDOXMLString propertyName(pl[i].getName()); XSDPropertyInfo* pi = getPropertyInfo(dataObjectType, pl[i]); PropertyDefinitionImpl propdef; @@ -961,15 +962,15 @@ propdef = pi->getPropertyDefinition(); propertyName = propdef.localname; } - + // Elements are written as <element> if (propdef.isElement) continue; - + // Many-valued properties are written as <element> if (pl[i].isMany()) continue; - + // if (pl[i].isContainment()) // continue; @@ -977,14 +978,14 @@ // Non contained properties become attributes ////////////////////////////////////////////////////////////////////// const Type& propertyType = pl[i].getType(); - + if (propertyType.isDataType()) { SDOXMLString propertyValue = (dataObject->getCString(pl[i])); if (pi && pi->getPropertyDefinition().isQName) { XMLQName qname(propertyValue); - + //{ //const SDOXMLString* prefix = namespaces.findPrefix(qname.getURI()); //if (prefix == 0) @@ -1004,19 +1005,19 @@ { propertyValue = (*it).second + ":" + qname.getLocalName(); } - else + else { char buffer[20]; SDOXMLString pref = "tnss"; sprintf(buffer, "%d", j++); pref += buffer; - rc = xmlTextWriterWriteAttributeNS(writer, + rc = xmlTextWriterWriteAttributeNS(writer, SDOXMLString("xmlns"), pref, NULL, qname.getURI()); propertyValue = pref + ":" + qname.getLocalName(); } - + } - rc = xmlTextWriterWriteAttribute(writer, + rc = xmlTextWriterWriteAttribute(writer, propertyName, propertyValue); } else @@ -1029,7 +1030,7 @@ } } } - + // -------------------- // Handle ChangeSummary // -------------------- @@ -1041,7 +1042,7 @@ handleChangeSummary(elementName, changeSummary); } } - + if (dataObjectType.isSequencedType()) { SequencePtr sequence = dataObject->getSequence(); @@ -1049,11 +1050,11 @@ { for (i=0; i<sequence->size(); i++) { - + if (sequence->isText(i)) { // This is a raw write rather than xmlTextWriterWriteString - // just in case the text has a CDATA section in it + // just in case the text has a CDATA section in it rc = xmlTextWriterWriteRaw( writer, SDOXMLString(sequence->getCStringValue(i))); @@ -1064,8 +1065,16 @@ SDOXMLString seqPropName = seqProp.getName(); const Type& seqPropType = seqProp.getType(); + // Do not write attributes as members of the sequence + XSDPropertyInfo* pi = getPropertyInfo(dataObjectType, seqProp); + PropertyDefinitionImpl propdef; + if (pi && !(pi->getPropertyDefinition().isElement)) + { + continue; + } + if (seqPropType.isDataObjectType()) - { + { DataObjectPtr doValue; if (seqProp.isMany()) { @@ -1095,6 +1104,10 @@ else { // Sequence member is a primitive + // Only write a primitive as an element if defined by the schema or if it's + // many-valued. + if (!pi && !seqProp.isMany()) continue; + /* Use our wrapper function just in case the element has CDATA in it */ writeXMLElement(writer, seqPropName, @@ -1105,17 +1118,17 @@ seqPropName, SDOXMLString(sequence->getCStringValue(i))); */ - + } // end DataType } // end - iterate over sequence - + } - + } // end sequence handling - + else { - + ////////////////////////////////////////////////////////////////////////// // Iterate over all the properties to find elements ////////////////////////////////////////////////////////////////////////// @@ -1123,7 +1136,7 @@ { if (dataObject->isSet(pl[i])) { - + SDOXMLString propertyName(pl[i].getName()); XSDPropertyInfo* pi = getPropertyInfo(dataObjectType, pl[i]); if (pi) @@ -1132,16 +1145,16 @@ continue; propertyName = pi->getPropertyDefinition().localname; } - + const Type& propertyType = pl[i].getType(); - + ////////////////////////////////////////////////////////////////////// // For a many-valued property get the list of values ////////////////////////////////////////////////////////////////////// if (pl[i].isMany()) { DataObjectList& dol = dataObject->getList(pl[i]); - for (int j = 0; j <dol.size(); j++) + for (unsigned int j = 0; j <dol.size(); j++) { // Handle non-containment reference to DataObject if (pl[i].isReference() ) @@ -1149,13 +1162,13 @@ writeReference(dataObject, pl[i], true, dol[j]); } else - { + { SDOXMLString typeURI = dol[j]->getType().getURI(); writeDO(dol[j], dol[j]->getType().getURI(), propertyName); } } } // end IsMany - + ////////////////////////////////////////////////////////////////////// // For a dataobject write the do ////////////////////////////////////////////////////////////////////// @@ -1169,11 +1182,11 @@ } else { - DataObjectPtr propDO = dataObject->getDataObject(pl[i]); + DataObjectPtr propDO = dataObject->getDataObject(pl[i]); writeDO(propDO, propDO->getType().getURI(), propertyName); } } - + ////////////////////////////////////////////////////////////////////// // For a primitive ////////////////////////////////////////////////////////////////////// @@ -1196,16 +1209,16 @@ if (dataObject->isNull(pl[i])) { rc = xmlTextWriterStartElementNS(writer, NULL, propertyName, NULL); - if (rc < 0) + if (rc < 0) { - SDO_THROW_EXCEPTION("writeDO", - SDOXMLParserException, + SDO_THROW_EXCEPTION("writeDO", + SDOXMLParserException, "xmlTextWriterStartElementNS failed"); } - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:nil", + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:nil", (const unsigned char*)"true"); - + writeXmlnsXsi(); rc = xmlTextWriterEndElement(writer); } @@ -1228,7 +1241,7 @@ } } } - + rc = xmlTextWriterEndElement(writer); return rc; @@ -1239,7 +1252,7 @@ // namespaceUriStack.pop(); //} } - + XSDPropertyInfo* SDOXMLWriter::getPropertyInfo(const Type& type, const Property& property) { if (dataFactory) @@ -1250,11 +1263,11 @@ { return (XSDPropertyInfo*)((DASProperty*)&property)->getDASValue("XMLDAS::PropertyInfo"); } - + } void SDOXMLWriter::writeReference( - DataObjectPtr dataObject, + DataObjectPtr dataObject, const Property& property, bool isElement, DataObjectPtr refferedToObject) @@ -1277,36 +1290,36 @@ refValue = reffedObject->getCString((const char*)typeDef.IDPropertyName); } } - + if (refValue.isNull()) { // need to get XPATH refValue = ((DataObjectImpl*)(DataObject*)reffedObject)->objectToXPath(); } - + if (!refValue.isNull()) { if (isElement) { // Set the IDREF value - xmlTextWriterWriteElement(writer, + xmlTextWriterWriteElement(writer, SDOXMLString(property.getName()), refValue); } else { // Set the IDREF value - xmlTextWriterWriteAttribute(writer, + xmlTextWriterWriteAttribute(writer, SDOXMLString(property.getName()), refValue); } } - } + } /** * A wrapper for the libxml2 function xmlTextWriterWriteElement * it detects CDATA sections before writing out element contents */ - int SDOXMLWriter::writeXMLElement(xmlTextWriterPtr writer, - const xmlChar *name, + int SDOXMLWriter::writeXMLElement(xmlTextWriterPtr writer, + const xmlChar *name, const char *content) { int rc = 0; @@ -1322,12 +1335,12 @@ // text and CDATA before writing the end element rc = xmlTextWriterStartElement(writer, name); - // Iterate along the string writing out text and CDATA sections + // Iterate along the string writing out text and CDATA sections // separately using the appropriate libxml2 calls std::string::size_type start = 0; std::string::size_type end = contentString.find(PropertySetting::XMLCDataStartMarker, 0); std::string::size_type length = 0; - + // loop while we still find a CDATA section that needs writing while ( end != std::string::npos ) { @@ -1339,25 +1352,25 @@ // find the end of the CDATA section start = end; end = contentString.find(PropertySetting::XMLCDataEndMarker, start); - + if ( end != std::string::npos ) { // we only nudge the start marker on to the end of the CDATA marker here - // so that if we fail to find the end CDATA marker the whole string gets + // so that if we fail to find the end CDATA marker the whole string gets // printed out by virtue of the line that follows the while loop start = start + strlen(PropertySetting::XMLCDataStartMarker); - + // write our the text from the CDATA section length = end - start; - rc = xmlTextWriterWriteCDATA(writer, + rc = xmlTextWriterWriteCDATA(writer, SDOXMLString(contentString.substr(start, length).c_str())); - // set current pos to end of CDATA section and + // set current pos to end of CDATA section and // start looking for the start marker again start = end + strlen(PropertySetting::XMLCDataEndMarker); end = contentString.find(PropertySetting::XMLCDataStartMarker, start); } - } + } // write out text following the last CDATA section rc = xmlTextWriterWriteString(writer, @@ -1368,7 +1381,7 @@ */ return rc; } - + } // End - namespace sdo } // End - namespace commonj http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SDOXSDWriter.cpp?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/SDOXSDWriter.cpp diff -u pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7.2.1 --- pecl/sdo/commonj/sdo/SDOXSDWriter.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SDOXSDWriter.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOXSDWriter.h" #include "iostream" @@ -163,7 +163,7 @@ int SDOXSDWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI, const propertyMap& openprops, int indent) { - int i; + unsigned int i; if (writer == NULL) { // Throw exception @@ -309,7 +309,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -380,7 +380,7 @@ { unsigned int j = type.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + type.getAlias(i); value = value + " "; @@ -421,7 +421,7 @@ // Create <element> definitions // ------------------------------------------------------- - int j; + unsigned int j; for (j = 0; j < pl.size(); j++) { const Property& prop = pl[j]; @@ -513,7 +513,7 @@ { unsigned int j = prop.getAliasCount(); SDOXMLString value = ""; - for (int i=0;i<j-1;i++) + for (unsigned int i=0;i<j-1;i++) { value = value + prop.getAlias(i); value = value + " "; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/SequenceImpl.cpp?r1=1.8&r2=1.8.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/SequenceImpl.cpp diff -u pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8.2.1 --- pecl/sdo/commonj/sdo/SequenceImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/SequenceImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/disable_warn.h" #include "commonj/sdo/Property.h" @@ -639,7 +639,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -701,7 +701,7 @@ {\ SEQUENCE_ITEM_LIST::iterator i;\ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\ - int j;\ + unsigned int j;\ if (index >= the_list.size()) {\ return add##primtype(p,v);\ }\ @@ -837,7 +837,7 @@ msg.c_str()); } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i=the_list.begin();(j < index) && (i != the_list.end()) ; ++i) { j++; @@ -890,7 +890,7 @@ SEQUENCE_ITEM_LIST::iterator i1, i2 = the_list.end(), i3 = the_list.end(); - int j = 0; + unsigned int j = 0; for (i3 = the_list.begin(); j < toIndex && j < fromIndex && i3 != the_list.end() ; ++i3); @@ -932,7 +932,7 @@ return false; } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -952,7 +952,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; @@ -973,7 +973,7 @@ } SEQUENCE_ITEM_LIST::iterator i; - int j = 0; + unsigned int j = 0; for (i= the_list.begin(); (j < index) && (i != the_list.end()); ++i) { j++; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.cpp?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.cpp diff -u pecl/sdo/commonj/sdo/TypeList.cpp:1.5 pecl/sdo/commonj/sdo/TypeList.cpp:1.5.2.1 --- pecl/sdo/commonj/sdo/TypeList.cpp:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef SDO_EXPORTS #define SDO_EXPORTS @@ -61,12 +61,12 @@ } -SDO_API const Type& TypeList::operator[] (int pos) const +SDO_API const Type& TypeList::operator[] (unsigned int pos) const { return *plist[pos]; } -SDO_API int TypeList::size () const +SDO_API unsigned int TypeList::size () const { return plist.size(); } http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/TypeList.h?r1=1.5&r2=1.5.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/TypeList.h diff -u pecl/sdo/commonj/sdo/TypeList.h:1.5 pecl/sdo/commonj/sdo/TypeList.h:1.5.2.1 --- pecl/sdo/commonj/sdo/TypeList.h:1.5 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/TypeList.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _TYPELIST_H_ #define _TYPELIST_H_ @@ -48,8 +48,8 @@ SDO_API TypeList(std::vector<const Type*> p); SDO_API TypeList(); virtual SDO_API ~TypeList(); - SDO_API const Type& operator[] (int pos) const; - SDO_API int size () const; + SDO_API const Type& operator[] (unsigned int pos) const; + SDO_API unsigned int size () const; SDO_API void insert (const Type* t); }; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelper.h?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelper.h diff -u pecl/sdo/commonj/sdo/XMLHelper.h:1.7 pecl/sdo/commonj/sdo/XMLHelper.h:1.7.2.1 --- pecl/sdo/commonj/sdo/XMLHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelper.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _XMLHELPER_H_ #define _XMLHELPER_H_ @@ -166,7 +166,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -174,7 +174,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; }; http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.cpp?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7.2.1 --- pecl/sdo/commonj/sdo/XMLHelperImpl.cpp:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -134,7 +134,7 @@ } const TypeList& tl = df->getTypes(); - for (int i = 0; i < tl.size(); i++) + for (unsigned int i = 0; i < tl.size(); i++) { if (!strcmp("RootType", tl[i].getName())) { @@ -448,13 +448,13 @@ indent); } - int XMLHelperImpl::getErrorCount() const + unsigned int XMLHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XMLHelperImpl::getErrorMessage(int errnum) const + const char* XMLHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XMLHelperImpl.h?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XMLHelperImpl.h diff -u pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7.2.1 --- pecl/sdo/commonj/sdo/XMLHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XMLHelperImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _XMLHELPERIMPL_H_ #define _XMLHELPERIMPL_H_ @@ -54,8 +54,8 @@ // Destructor virtual ~XMLHelperImpl(); - virtual int getErrorCount() const; - virtual const char* getErrorMessage(int errnum) const; + virtual unsigned int getErrorCount() const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelper.h?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelper.h diff -u pecl/sdo/commonj/sdo/XSDHelper.h:1.7 pecl/sdo/commonj/sdo/XSDHelper.h:1.7.2.1 --- pecl/sdo/commonj/sdo/XSDHelper.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelper.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _XSDHELPER_H_ #define _XSDHELPER_H_ @@ -122,7 +122,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const = 0; + virtual unsigned int getErrorCount() const = 0; /** getErrorMessage gets the nth error message * @@ -130,7 +130,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const = 0; + virtual const char* getErrorMessage(unsigned int errnum) const = 0; /** * http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.cpp?r1=1.8&r2=1.8.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.cpp diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8.2.1 --- pecl/sdo/commonj/sdo/XSDHelperImpl.cpp:1.8 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.cpp Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #include "commonj/sdo/SDOXMLFileWriter.h" // Include first to avoid libxml compile problems! #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems! @@ -141,7 +141,7 @@ prop.typeUri : prop.substituteUri; const Type& rootType = dataFactory->getType(typeUri, entryName); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { if (!pl[j].getType().isDataType() && strcmp(pl[j].getType().getURI(),Type::SDOTypeNamespaceURI.c_str())) @@ -188,7 +188,7 @@ const Type* rootType = df->findType(typeUri,"RootType"); if (rootType == 0) return; PropertyList pl = rootType->getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) ((DASProperty*)&pl[j])->getDASValue("XMLDAS::PropertyInfo"); @@ -342,7 +342,7 @@ (const char*)ty.name, (const char*)ty.parentTypeUri, (const char*)ty.parentTypeName, - (const char*)ty.isRestriction); + ty.isRestriction); } catch (SDORuntimeException& e) { @@ -395,7 +395,7 @@ const Type& rootType = dataFactory->getType(prop.typeUri, "RootType"); PropertyList pl = rootType.getProperties(); - for (int j = 0; j < pl.size(); j++) + for (unsigned int j = 0; j < pl.size(); j++) { XSDPropertyInfo* pi = (XSDPropertyInfo*) @@ -444,9 +444,9 @@ (const char*)prop.name, (const char*)prop.typeUri, (const char*)prop.typeName, - (const char*)prop.isMany, - (const char*)prop.isReadOnly, - (const char*)prop.isContainment); + prop.isMany, + prop.isReadOnly, + prop.isContainment); LOGINFO_1(INFO,"XSDHelper adds property %s",(const char*)(prop.name)); @@ -611,13 +611,13 @@ return retString; } - int XSDHelperImpl::getErrorCount() const + unsigned int XSDHelperImpl::getErrorCount() const { return parseErrors.size(); } - const char* XSDHelperImpl::getErrorMessage(int errnum) const + const char* XSDHelperImpl::getErrorMessage(unsigned int errnum) const { if (errnum >= 0 && errnum < parseErrors.size()) { http://cvs.php.net/viewvc.cgi/pecl/sdo/commonj/sdo/XSDHelperImpl.h?r1=1.7&r2=1.7.2.1&diff_format=u Index: pecl/sdo/commonj/sdo/XSDHelperImpl.h diff -u pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7.2.1 --- pecl/sdo/commonj/sdo/XSDHelperImpl.h:1.7 Fri Nov 24 10:44:27 2006 +++ pecl/sdo/commonj/sdo/XSDHelperImpl.h Thu Dec 7 12:23:05 2006 @@ -17,7 +17,7 @@ * under the License. */ -/* $Rev: 452786 $ $Date: 2006/11/24 10:44:27 $ */ +/* $Rev: 479634 $ $Date: 2006/12/07 12:23:05 $ */ #ifndef _XSDHELPERIMPL_H_ #define _XSDHELPERIMPL_H_ @@ -77,7 +77,7 @@ * may be errors to report or handle. */ - virtual int getErrorCount() const; + virtual unsigned int getErrorCount() const; /** getErrorMessage gets the nth error message * @@ -85,7 +85,7 @@ * in which the parser error occurred. */ - virtual const char* getErrorMessage(int errnum) const; + virtual const char* getErrorMessage(unsigned int errnum) const; virtual void setError(const char* error); /** generate buildsXSD from types/properties
« previous php.pecl.cvs (#6763) next »