You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2006/06/09 12:30:34 UTC
svn commit: r413000 - in /incubator/tuscany/cpp/sdo: projects/tuscany_sdo/
runtime/core/sdo_axiom/ runtime/core/src/commonj/sdo/ runtime/core/test/
Author: edslattery
Date: Fri Jun 9 03:30:32 2006
New Revision: 413000
URL: http://svn.apache.org/viewvc?rev=413000&view=rev
Log:
removal of "using namespace" from headers.
Addition of XSDToSDO in SDOUtils
Modified:
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb
incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt
incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummary.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ParserErrorSetter.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp
incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h
incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp
incubator/tuscany/cpp/sdo/runtime/core/test/utils.cpp
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.ncb?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projects/tuscany_sdo/tuscany_sdo.opt?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp Fri Jun 9 03:30:32 2006
@@ -17,9 +17,14 @@
/* $Rev$ $Date$ */
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
#include "sdo_axiom.h"
using namespace commonj::sdo;
+using namespace std;
namespace commonj
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummary.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummary.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummary.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummary.h Fri Jun 9 03:30:32 2006
@@ -26,7 +26,6 @@
#include "commonj/sdo/ChangedDataObjectList.h"
-using namespace std;
namespace commonj{
namespace sdo {
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp Fri Jun 9 03:30:32 2006
@@ -255,7 +255,7 @@
// build a Setting list for the set properties
- deletedMap.insert(make_pair(ob,deleteLogItem(
+ deletedMap.insert(std::make_pair(ob,deleteLogItem(
(DataObject*)ob, prop,ob->getSequence(),
oldpath,
container)));
@@ -421,7 +421,7 @@
// deleted or created.
changedDataObjects.append(ob, ChangedDataObjectList::Create);
- createdMap.insert(make_pair(ob,createLogItem(ob->getType(),prop,container)));
+ createdMap.insert(std::make_pair(ob,createLogItem(ob->getType(),prop,container)));
return;
}
@@ -780,7 +780,7 @@
if (changeLogIter == changedMap.end())
{
LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
- changedMap.insert(make_pair(ob, changeLogItem(ob->getType(),prop,
+ changedMap.insert(std::make_pair(ob, changeLogItem(ob->getType(),prop,
ob->getSequence(), ob)));
changedDataObjects.append(ob, ChangedDataObjectList::Change);
}
@@ -1297,7 +1297,7 @@
case Type::ChangeSummaryType:
default:
{
- string msg("Cannot set CString on object of type:");
+ std::string msg("Cannot set CString on object of type:");
msg += p.getType().getName();
SDO_THROW_EXCEPTION("setString" ,
SDOInvalidConversionException, msg.c_str());
@@ -1323,7 +1323,7 @@
LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
- changedMap.insert(make_pair((DataObjectImpl*)pdob,
+ changedMap.insert(std::make_pair((DataObjectImpl*)pdob,
changeLogItem(dob->getType(),p,
dob->getSequence(), (DataObjectImpl*)pdob)));
changedDataObjects.append((DataObjectImpl*)pdob,
@@ -1368,7 +1368,7 @@
{
LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
- changedMap.insert(make_pair((DataObjectImpl*)pdob,
+ changedMap.insert(std::make_pair((DataObjectImpl*)pdob,
changeLogItem(dob->getType(),p,
dob->getSequence(), (DataObjectImpl*)pdob)));
changedDataObjects.append((DataObjectImpl*)pdob,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h Fri Jun 9 03:30:32 2006
@@ -31,7 +31,6 @@
#include <map>
-using namespace std;
namespace commonj{
namespace sdo {
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp Fri Jun 9 03:30:32 2006
@@ -233,7 +233,7 @@
{
if ((index < 0) || (index >= size()))
{
- string msg("Invalid index : ");
+ std::string msg("Invalid index : ");
msg += index;
SDO_THROW_EXCEPTION("(ChangeSummary)validateIndex", SDOIndexOutOfRangeException,
msg.c_str());
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h Fri Jun 9 03:30:32 2006
@@ -30,13 +30,13 @@
#include <map>
-using namespace std;
+
namespace commonj{
namespace sdo{
-typedef map<string, PropertyImpl> propertyMap;
+ typedef std::map<std::string, PropertyImpl> propertyMap;
/**
* DataFactoryImpl implements the abstract class DataFactory.
@@ -682,7 +682,7 @@
virtual bool generateInterface(const SDOString& fileroot, const SDOString& factoryname);
private:
- typedef map<string, TypeImpl*> TYPES_MAP;
+ typedef std::map<std::string, TypeImpl*> TYPES_MAP;
TYPES_MAP types;
std::vector<DataFactory*> compatibleFactories;
@@ -699,7 +699,7 @@
bool recursiveCheck(TypeImpl* cs, TypeImpl* t);
bool checkForValidChangeSummary(TypeImpl* t);
- typedef vector<TypeImpl*> TYPES_VECTOR;
+ typedef std::vector<TypeImpl*> TYPES_VECTOR;
TYPES_VECTOR cstypes;
// TODO: Remove char* form of method since it is not exposed to users
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp Fri Jun 9 03:30:32 2006
@@ -169,7 +169,7 @@
{
if (typeUnset)
{
- string msg("The list property is open, and the type of the contents has not bee determined yet.");
+ std::string msg("The list property is open, and the type of the contents has not bee determined yet.");
SDO_THROW_EXCEPTION("Get Type", SDOTypeNotFoundException,
msg.c_str());
}
@@ -205,7 +205,7 @@
{
if (plist[i] == d)
{
- string msg("Insertion of object which already exists in the list:");
+ std::string msg("Insertion of object which already exists in the list:");
msg += typeURI;
msg += " ";
msg += typeName;
@@ -217,7 +217,7 @@
||
strcmp(typeName,d->getType().getName()))
{
- string msg("Insertion of object of the wrong type to a list:");
+ std::string msg("Insertion of object of the wrong type to a list:");
msg += typeURI;
msg += " ";
msg += typeName;
@@ -238,7 +238,7 @@
if (con != container)
{
/* this data object is already contained somewhere else */
- string msg("Insertion of object to list, object is already contained:");
+ std::string msg("Insertion of object to list, object is already contained:");
msg += d->getType().getURI();
msg += " ";
msg += d->getType().getName();
@@ -287,7 +287,7 @@
if (d->getContainer() != 0)
{
- string msg("Insertion of object into list from another factory is only allowed if the parent is null: ");
+ std::string msg("Insertion of object into list from another factory is only allowed if the parent is null: ");
const Type& t = d->getType();
msg += t.getURI();
@@ -312,7 +312,7 @@
return;
}
- string msg("Insertion into list fromm incompatible factory:");
+ std::string msg("Insertion into list fromm incompatible factory:");
const Type& t = d->getType();
msg += t.getURI();
@@ -363,7 +363,7 @@
}
// no match..
- string msg("Insertion of object of incompatible type ");
+ std::string msg("Insertion of object of incompatible type ");
msg += objectType.getURI();
msg += "#";
msg += objectType.getName();
@@ -440,7 +440,7 @@
{
if (plist[i] == d)
{
- string msg("Append of object which already exists in the list:");
+ std::string msg("Append of object which already exists in the list:");
msg += typeURI;
msg += " ";
msg += typeName;
@@ -464,7 +464,7 @@
if (con != container)
{
/* this data object is already contained somewhere else */
- string msg("Append of object to list, object is already contained:");
+ std::string msg("Append of object to list, object is already contained:");
msg += d->getType().getURI();
msg += " ";
msg += d->getType().getName();
@@ -821,7 +821,7 @@
if ((index < 0) || (index >= size()))
{
char val[32];
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
sprintf(val,"%d",index);
msg += val;
SDO_THROW_EXCEPTION("validateIndex", SDOIndexOutOfRangeException,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ParserErrorSetter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ParserErrorSetter.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ParserErrorSetter.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ParserErrorSetter.h Fri Jun 9 03:30:32 2006
@@ -25,7 +25,6 @@
#include "commonj/sdo/disable_warn.h"
#include <vector>
-using namespace std;
namespace commonj{
namespace sdo{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h Fri Jun 9 03:30:32 2006
@@ -23,7 +23,6 @@
#include "export.h"
#include <vector>
-using namespace std;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h Fri Jun 9 03:30:32 2006
@@ -24,7 +24,6 @@
#include "commonj/sdo/SDOXMLString.h"
#include <vector>
-using namespace std;
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/RefCountingPointer.h Fri Jun 9 03:30:32 2006
@@ -25,7 +25,6 @@
#include "commonj/sdo/SDORuntimeException.h"
#include <iostream>
-using namespace std;
namespace commonj{
namespace sdo{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp Fri Jun 9 03:30:32 2006
@@ -190,28 +190,28 @@
// ========================================================================
// print self
// ========================================================================
-ostream& SDORuntimeException :: PrintSelf(ostream &os) const
+std::ostream& SDORuntimeException :: PrintSelf(std::ostream &os) const
{
char lineNumber[100];
sprintf(lineNumber, "%d",locations[0].line);
- os << "Exception object :" << endl;
- os << " class: " << class_name << endl;
- os << " file name: " << locations[0].file << endl;
- os << " line number: " << lineNumber << endl;
- os << " function: " << locations[0].function << endl;
- os << " description: " << message_text << endl;
- os << " location history:" << endl;
+ os << "Exception object :" << std::endl;
+ os << " class: " << class_name << std::endl;
+ os << " file name: " << locations[0].file << std::endl;
+ os << " line number: " << lineNumber << std::endl;
+ os << " function: " << locations[0].function << std::endl;
+ os << " description: " << message_text << std::endl;
+ os << " location history:" << std::endl;
// TODO - commented out - a two-location rethrow causes an access
// violation here.
//int i=1;
//while (i < location_set)
//{
- // os << " " << i << ")" << endl;
- // os << " file: " << locations[i].file << endl;
- // os << " line: " << locations[i].line << endl;
- // os << " function: " << locations[i].function << endl;
+ // os << " " << i << ")" << std::endl;
+ // os << " file: " << locations[i].file << std::endl;
+ // os << " line: " << locations[i].line << std::endl;
+ // os << " function: " << locations[i].function << std::endl;
// i++;
//}
return os;
@@ -220,7 +220,7 @@
// ========================================================================
// ostream operator <<
// ========================================================================
-SDO_API ostream& operator<< (ostream &os, const SDORuntimeException &except)
+SDO_API std::ostream& operator<< (std::ostream &os, const SDORuntimeException &except)
{
return except.PrintSelf(os);
} // end ostream operator <<
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.h Fri Jun 9 03:30:32 2006
@@ -26,7 +26,6 @@
#include <string>
#include <iostream>
-using namespace std;
/** SDORuntimeException - Exception base class.
@@ -202,14 +201,14 @@
SDO_API void trace(const char* text="%1:\n %3 %4 %2");
- SDO_API virtual ostream& PrintSelf(ostream &os) const;
+ SDO_API virtual std::ostream& PrintSelf(std::ostream &os) const;
/** operator << to write the exception
*
* ostream operator <<
*/
- SDO_API friend ostream& operator<< (ostream &os, const SDORuntimeException &except);
+ SDO_API friend std::ostream& operator<< (std::ostream &os, const SDORuntimeException &except);
protected:
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp Fri Jun 9 03:30:32 2006
@@ -22,6 +22,8 @@
#include "commonj/sdo/XSDTypeInfo.h"
#include "commonj/sdo/SDORuntimeException.h"
#include "commonj/sdo/Logging.h"
+#include "commonj/sdo/SDOUtils.h"
+
#include <stdio.h>
@@ -1314,107 +1316,12 @@
if (qname.getURI().equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
{
uri = Type::SDOTypeNamespaceURI.c_str();
- if (qname.getLocalName().equalsIgnoreCase("ID"))
- {
- name = "String";
- }
- if (qname.getLocalName().equalsIgnoreCase("NCName"))
- {
- name = "String";
- }
- if (qname.getLocalName().equalsIgnoreCase("string"))
- {
- name = "String";
- }
- else if (qname.getLocalName().equalsIgnoreCase("anyType"))
- {
- name = "DataObject";
- }
- else if (qname.getLocalName().equalsIgnoreCase("int"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("integer"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("negativeInteger"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("nonNegativeInteger"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("positiveInteger"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("nonPositiveInteger"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("unsignedLong"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("unsignedShort"))
- {
- name = "Integer";
- }
- else if (qname.getLocalName().equalsIgnoreCase("unsignedInt"))
- {
- name = "Long";
- }
- else if (qname.getLocalName().equalsIgnoreCase("long"))
- {
- name = "Long";
- }
- else if (qname.getLocalName().equalsIgnoreCase("double"))
- {
- name = "Double";
- }
- else if (qname.getLocalName().equalsIgnoreCase("short"))
+ name = SDOUtils::XSDToSDO((const char*)(qname.getLocalName()));
+ if (name.isNull())
{
- name = "Short";
- }
- else if (qname.getLocalName().equalsIgnoreCase("unsignedByte"))
- {
- name = "Short";
- }
- else if (qname.getLocalName().equalsIgnoreCase("float"))
- {
- name = "Float";
- }
- else if (qname.getLocalName().equalsIgnoreCase("boolean"))
- {
- name = "Boolean";
- }
- else if (qname.getLocalName().equalsIgnoreCase("byte"))
- {
- name = "Byte";
- }
- else if (qname.getLocalName().equalsIgnoreCase("base64Binary"))
- {
- name = "Bytes";
- }
- else if (qname.getLocalName().equalsIgnoreCase("hexBinary"))
- {
- name = "Bytes";
- }
- else if (qname.getLocalName().equalsIgnoreCase("anyURI"))
- {
- name = "URI";
- }
- else if (qname.getLocalName().equalsIgnoreCase("QName"))
- {
- name = "URI";
- }
- else
- {
- // Default unknown xs: types to string??
name = "String";
}
+
}
// Temporary hack: ChangeSummaryType is ChangeSummary in core
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.cpp Fri Jun 9 03:30:32 2006
@@ -28,7 +28,87 @@
namespace commonj {
namespace sdo {
+//////////////////////////////////////////////////////////////////////////
+// Conversions
+//////////////////////////////////////////////////////////////////////////
+
+ std::map<std::string,std::string> SDOUtils::SdoToXsd;
+
+ std::map<std::string,std::string> SDOUtils::XsdToSdo;
+
+ bool SDOUtils::populated = false;
+
+ bool SDOUtils::populate()
+ {
+ SDOUtils::XsdToSdo["ID"] = "String";
+ SDOUtils::XsdToSdo["NCName"] = "String";
+ SDOUtils::XsdToSdo["string"] = "String";
+ SDOUtils::XsdToSdo["anyType"] = "DataObject";
+ SDOUtils::XsdToSdo["int"] = "Integer";
+ SDOUtils::XsdToSdo["integer"] = "Integer";
+ SDOUtils::XsdToSdo["negativeInteger"] = "Integer";
+ SDOUtils::XsdToSdo["nonNegativeInteger"] = "Integer";
+ SDOUtils::XsdToSdo["positiveInteger"] = "Integer";
+ SDOUtils::XsdToSdo["nonpositiveInteger"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedShort"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedInt"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedLong"] = "Long";
+ SDOUtils::XsdToSdo["double"] = "Double";
+ SDOUtils::XsdToSdo["short"] = "Short";
+ SDOUtils::XsdToSdo["unsignedByte"] = "Short";
+ SDOUtils::XsdToSdo["float"] = "Float";
+ SDOUtils::XsdToSdo["boolean"] = "Boolean";
+ SDOUtils::XsdToSdo["byte"] = "Byte";
+ SDOUtils::XsdToSdo["base64Binary"] = "Bytes";
+ SDOUtils::XsdToSdo["hexBinary"] = "Bytes";
+ SDOUtils::XsdToSdo["anyURI"] = "URI";
+ SDOUtils::XsdToSdo["QName"] = "URI";
+
+ SDOUtils::SdoToXsd["String"] = "string";
+ SDOUtils::SdoToXsd["DataObject"] = "anyType";
+ SDOUtils::SdoToXsd["Integer"] = "integer";
+ SDOUtils::SdoToXsd["Long"] = "unsignedLong";
+ SDOUtils::SdoToXsd["Double"] = "double";
+ SDOUtils::SdoToXsd["Short"] = "short";
+ SDOUtils::SdoToXsd["Float"] = "float";
+ SDOUtils::SdoToXsd["Boolean"] = "boolean";
+ SDOUtils::SdoToXsd["Byte"] = "byte";
+ SDOUtils::SdoToXsd["Bytes"] = "base64Binary";
+ SDOUtils::SdoToXsd["URI"] = "anyURI";
+
+ SDOUtils::populated = true;
+ return true;
+ }
+
+ const char* SDOUtils::SDOToXSD(const char* sdoname)
+ {
+ if (sdoname == 0)
+ {
+ return SDOUtils::SdoToXsd["String"].c_str();
+ }
+ if (!SDOUtils::populated) SDOUtils::populate();
+ string& s = SDOUtils::SdoToXsd[sdoname];
+ if (s.empty())
+ {
+ return SDOUtils::SdoToXsd["String"].c_str();
+ }
+ return s.c_str();
+ }
+
+
+ const char* SDOUtils::XSDToSDO(const char* xsdname)
+ {
+ if (xsdname == 0)
+ {
+ return SDOUtils::XsdToSdo["string"].c_str();
+ }
+ if (!SDOUtils::populated) SDOUtils::populate();
+ string& s = SDOUtils::XsdToSdo[xsdname];
+ if (s.empty())
+ return SDOUtils::XsdToSdo["string"].c_str();
+ return s.c_str();
+ }
//////////////////////////////////////////////////////////////////////////
// Print Tabs
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOUtils.h Fri Jun 9 03:30:32 2006
@@ -21,6 +21,8 @@
#define _SDOUTILS_H_
#include "commonj/sdo/DataObject.h"
+#include <map>
+#include <string>
namespace commonj
{
@@ -38,11 +40,21 @@
public:
- static SDO_API void printDataObject(ostream& out, DataObjectPtr d);
+ static SDO_API void printDataObject(std::ostream& out, DataObjectPtr d);
+ static SDO_API const char* SDOToXSD(const char* sdoname);
+ static SDO_API const char* XSDToSDO(const char* xsdname);
private:
- static void printDataObject(ostream& out, DataObjectPtr d, unsigned int incr);
- static void printTabs(ostream& out, unsigned int incr);
+
+ static bool populate();
+ static bool populated;
+
+ static void printDataObject(std::ostream& out, DataObjectPtr d, unsigned int incr);
+ static void printTabs(std::ostream& out, unsigned int incr);
+
+ static std::map<std::string,std::string> XsdToSdo;
+ static std::map<std::string,std::string> SdoToXsd;
+
};
} // End - namespace sdo
} // End - namespace commonj
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp Fri Jun 9 03:30:32 2006
@@ -32,7 +32,7 @@
#define CHECK_RANGE\
if (index >= the_list.size()){\
- string msg("Index out of range:");\
+ std::string msg("Index out of range:");\
msg += index;\
SDO_THROW_EXCEPTION("Sequence API", SDOIndexOutOfRangeException,\
msg.c_str());\
@@ -85,7 +85,7 @@
if (isText(index))
{
- string msg("Cannot get property of a text item");
+ std::string msg("Cannot get property of a text item");
msg += index;
SDO_THROW_EXCEPTION("getProperty", SDOUnsupportedOperationException,
msg.c_str());
@@ -97,7 +97,7 @@
if (i != the_list.end()) {
return *((*i).getProp());
}
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += index;
SDO_THROW_EXCEPTION("getProperty", SDOIndexOutOfRangeException,
msg.c_str());
@@ -117,7 +117,7 @@
}
return (*i).getProp()->getTypeEnum();
}
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += index;
SDO_THROW_EXCEPTION("getTypeEnum", SDOIndexOutOfRangeException,
msg.c_str());
@@ -132,7 +132,7 @@
if (i != the_list.end()) {
if ((*i).getProp() == 0)
{
- string msg("Get list index on text property");
+ std::string msg("Get list index on text property");
SDO_THROW_EXCEPTION("getListIndex", SDOUnsupportedOperationException,
msg.c_str());
}
@@ -142,12 +142,12 @@
}
else
{
- string msg("Get list index on text single valued property");
+ std::string msg("Get list index on text single valued property");
SDO_THROW_EXCEPTION("getListIndex", SDOUnsupportedOperationException,
msg.c_str());
}
}
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += index;
SDO_THROW_EXCEPTION("getListIndex", SDOIndexOutOfRangeException,
msg.c_str());
@@ -454,7 +454,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -503,7 +503,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -568,7 +568,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -621,7 +621,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -683,7 +683,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -763,7 +763,7 @@
}\
if (p == 0)\
{\
- string msg("Cannot find property:");\
+ std::string msg("Cannot find property:");\
msg += propertyName;\
SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
msg.c_str());\
@@ -829,7 +829,7 @@
void SequenceImpl::remove(unsigned int index)
{
if (index >= the_list.size()) {
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += index;
SDO_THROW_EXCEPTION("Sequence remove", SDOIndexOutOfRangeException,
msg.c_str());
@@ -869,7 +869,7 @@
void SequenceImpl::move(unsigned int toIndex, unsigned int fromIndex)
{
if (fromIndex >= the_list.size()) {
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += fromIndex;
SDO_THROW_EXCEPTION("Sequence Move", SDOIndexOutOfRangeException,
msg.c_str());
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h Fri Jun 9 03:30:32 2006
@@ -23,7 +23,7 @@
#include "commonj/sdo/disable_warn.h"
#include <vector>
-using namespace std;
+
#include "commonj/sdo/Sequence.h"
#include "commonj/sdo/SDODate.h"
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp Fri Jun 9 03:30:32 2006
@@ -99,7 +99,7 @@
{
if ((index < 0) || (index > size()))
{
- string msg("Index out of range:");
+ std::string msg("Index out of range:");
msg += index;
SDO_THROW_EXCEPTION("ValidateIndex", SDOIndexOutOfRangeException,
msg.c_str());
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h Fri Jun 9 03:30:32 2006
@@ -37,7 +37,7 @@
#define CHAR_SIZE 1
#define BYTE_SIZE 1
-using namespace std;
+
namespace commonj{
namespace sdo{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp Fri Jun 9 03:30:32 2006
@@ -137,7 +137,7 @@
}
else
{
- string msg("createDocument - cannot find element ");
+ std::string msg("createDocument - cannot find element ");
msg += elementname;
SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
msg.c_str());
@@ -154,7 +154,7 @@
}
else
{
- string msg("createDocument - unable to find root type in namespace ");
+ std::string msg("createDocument - unable to find root type in namespace ");
if (rootElementURI != 0)
msg += rootElementURI;
else
@@ -192,7 +192,7 @@
XMLDocumentPtr XMLHelperImpl::load(
- istream& inXml,
+ std::istream& inXml,
const char* targetNamespaceURI)
{
DataObjectPtr rootDataObject;
@@ -207,7 +207,7 @@
const char* inXml,
const char* targetNamespaceURI)
{
- istringstream str(inXml);
+ std::istringstream str(inXml);
return load(str, targetNamespaceURI);
}
@@ -246,7 +246,7 @@
save(createDocument(dataObject,rootElementURI, rootElementName), outXml, indent);
}
- // Serializes the datagraph to a string
+ // Serializes the datagraph to a std::string
char* XMLHelperImpl::save(XMLDocumentPtr doc,
int indent)
{
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h Fri Jun 9 03:30:32 2006
@@ -71,7 +71,7 @@
const char* xmlFile,
const char* targetNamespaceURI = 0);
virtual XMLDocumentPtr load(
- istream& inXml,
+ std::istream& inXml,
const char* targetNamespaceURI = 0);
virtual XMLDocumentPtr load(
const char* inXml,
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp Fri Jun 9 03:30:32 2006
@@ -99,7 +99,7 @@
const char* XSDHelperImpl::define(const char* schema)
{
- istringstream str(schema);
+ std::istringstream str(schema);
SDOSchemaSAX2Parser schemaParser(schemaInfo, this);
clearErrors();
str >> schemaParser;
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp Fri Jun 9 03:30:32 2006
@@ -44,6 +44,8 @@
int totaltests=0;
int value = 0;
+ TEST ( sdotest::xsdtosdo() );
+
/* groups now supported*/
TEST ( sdotest::testany("list1.xsd",0,"list1.xml", 0) );
TEST ( sdotest::testany("b48636.xsd",0,"b48636.xml", 0) );
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h Fri Jun 9 03:30:32 2006
@@ -42,6 +42,7 @@
static int dumpproperties(FILE *f, DataObjectPtr root);
static int printset(FILE *f, ChangeSummaryPtr cs);
+ static int xsdtosdo();
static void changeSummaryHeader(ChangeSummaryPtr cs);
static void changeSummaryFooter();
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp Fri Jun 9 03:30:32 2006
@@ -33,6 +33,54 @@
using namespace commonj::sdo;
+int sdotest::xsdtosdo()
+{
+const char* value;
+
+value = SDOUtils::XSDToSDO("string");
+if (!silent)cout << "XSDToSDO(string)=" << value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO("int");
+if (!silent)cout << "XSDToSDO(int)="<< value << endl;
+if (strcmp(value,"Integer")) return 0;
+
+value = SDOUtils::XSDToSDO("notinlist");
+if (!silent)cout << "XSDToSDO(notinlist)="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO("");
+if (!silent)cout << "XSDToSDO(\"\")="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO(0);
+if (!silent)cout << "XSDToSDO(0)="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::SDOToXSD("String");
+if (!silent)cout << "SDOToXSD(String)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD("Long");
+if (!silent)cout << "SDOToXSD(Long)="<< value << endl;
+if (strcmp(value,"unsignedLong")) return 0;
+
+value = SDOUtils::SDOToXSD("notinlist");
+if (!silent)cout << "SDOToXSD(notinlist)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD("");
+if (!silent)cout << "SDOToXSD(\"\")="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD(0);
+if (!silent)cout << "SDOToXSD(0)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+return 1;
+
+}
+
int sdotest::compatiblefactory()
{
DataFactoryPtr f1 = DataFactory::getDataFactory();
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/utils.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/utils.cpp?rev=413000&r1=412999&r2=413000&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/utils.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/utils.cpp Fri Jun 9 03:30:32 2006
@@ -26,7 +26,7 @@
#include "sdotest.h"
-bool sdotest::silent = false;
+bool sdotest::silent = true;
bool sdotest::ramping = false;
void sdotest::printOldValues(FILE *f, ChangeSummaryPtr cs, DataObjectPtr dol)
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org