另一个Critia的代码示例 [英] Another Code Sample for Crituque

查看:136
本文介绍了另一个Critia的代码示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面列出的简短示例程序有一些功能,我发现这是一种糟糕的风格。特别是,他们无法传达此程序中使用的

名称与声明它们的位置之间的联系以及

或已定义。我想知道这段代码是否有任何功能你需要b $ b相信代表糟糕的编程技巧。如何更好地实现该功能?


/ *

* Apache软件许可证,版本1.1

*

*版权所有(c)1999-2003 Apache Software Foundation。所有权利

*保留。

*请访问以下网址获取完整的许可声明:
http://cvs.apache.org/ viewcvs.cgi / xm ... 1.18& view = auto

* /


/ *

* $ Id:CreateDOMDocument.cpp,v 1.18 2003/12/10 23:48:53 neilg Exp $

* /


/ *

*此示例说明了如何在内存中创建DOM树。

*然后打印树中元素的数量。

* / < br $>
//

--------------------------------- ------------------------------------------

//包含

//

----------------------------- ----------------------------------------------

#include< xercesc / util / PlatformUtils.hpp>

#include< xercesc / util / XMLString.hpp>

#inc lude< xercesc / dom / DOM.hpp>

#if定义(XERCES_NEW_IOSTREAMS)

#include< iostream>

#else

#include< iostream.h>

#endif


XERCES_CPP_NAMESPACE_USE


//

---------------------------------------- -----------------------------------

//这是一个简单的类这让我们变得轻松(虽然不是非常高效)b $ b //将char *数据转码为XMLCh数据。

//

-------------------------------------------- -------------------------------

class XStr

{

public:

//

---------------------- -------------------------------------------------

//构造函数和析构函数

//

-------------------- -------------------------------------------------- -

XStr(const char * const toTranscode)

{

//调用私有转码方法

fUnicodeForm = XMLString :: transcode(toTranscode);

}


~XStr()

{

XMLString :: release(& fUnicodeForm);

}

//

---- -------------------------------------------------- -----------------

//吸气方法

//

--- -------------------------------------------------- ------------------

const XMLCh * unicodeForm()const

{

返回fUnicodeForm;

}


私人:

//

------ -------------------------------------------------- ---------------

//私人数据成员

//

// fUnicodeForm

//这是字符串的Unicode XMLCh格式。

//

------------- -------------------------------------------------- --------

XMLCh * fUnicodeForm;

};


#define X(str)XStr( str).unicodeForm()

//

- -------------------------------------------------- ------------------------

// main

//

----------------------------------------------- ----------------------------


int main(int argC,char * argV [ ])

{

//初始化XML4C2系统。

试试

{

XMLPlatformUtils :: Initialize();

}


catch(const XMLException& toCatch)

{

char * pMsg = XMLString :: transcode(toCatch.getMessage());

XERCES_STD_QUALIFIER cerr<< Xerces-c初始化期间出错

\ n

<< "例外消息:

<< pMsg;

XMLString :: release(& pMsg);

返回1;

}


//观察特殊案例帮助请求

int errorCode = 0;

if(argC> 1)

{

XERCES_STD_QUALIFIER cout<< " \ nUsage:\ n"

" CreateDOMDocument\\\
\ n"

"这个程序从头开始创建一个新的DOM文档

memory.\ n"

然后,它打印树中元素的数量。\ n"

<< XERCES_STD_QUALIFIER endl;

errorCode = 1;

}

if(errorCode){

XMLPlatformUtils :: Terminate( );

返回errorCode;

}


{

//将整个测试嵌套在一个内部块。

//我们在下面创建的树与XercesDOMParser

将创建的
相同,除了没有空格文本节点将是

创建的。


//< company>

//< product> Xerces-C< / product>

//< category idea =''great''> XML解析工具< / category>

//< developedBy> Apache Software Foundation< / developBy>

//< / company>


DOMImplementation * impl =

DOMImplementationRegistry :: getDOMImplementation(X(&) ;核心));


if(impl!= NULL)

{

试试

{

DOMDocument * doc = impl-> createDocument(

0,//根元素名称空间

URI。

X(" company"),//根元素名称

0); //文档类型对象

(DTD)。


DOMElement * rootElem = doc-> getDocumentElement();


DOMElement * prodElem = doc-> createElement(X(" product"));

rootElem-> appendChild(prodElem);


DOMText * prodDataVal = doc-> createTextNode(X(" Xerces-C"));

prodElem-> appendChild(prodDataVal);


DOMElement * catElem = doc-> createElement(X(" category"));

rootElem-> appendChild(catElem);


catElem - > setAttribute(X(" idea"),X(" great"));


DOMText * catDataVal = doc-> createTextNode(X(" XML Parsing)

工具"));

catElem-> appendChild(catDataVal);


DOMElement * devByElem =

doc-> createElement(X(" developedBy"));

rootElem-> appendChild(devByElem);


DOMText * devByDataVal = doc-> createTextNode(X(&qu ot; Apache

Software Foundation"));

devByElem-> appendChild(devByDataVal);


//

//现在计算上面DOM树中元素的数量。

//


unsigned int elementCount =

doc-> getElementsByTagName(X(" *")) - > getLength();

XERCES_STD_QUALIFIER cout<< 刚刚创建的树包含:

<< elementCount

<< "元素"。 << XERCES_STD_QUALIFIER endl;


doc-> release();

}


catch(const DOMException& e )

{

XERCES_STD_QUALIFIER cerr<< DOMException代码是: <<

e.code<< XERCES_STD_QUALIFIER endl;

errorCode = 2;

}

catch(...)

{

XERCES_STD_QUALIFIER cerr<< 创建

文档时出错 << XERCES_STD_QUALIFIER endl;

errorCode = 3;

}

} //(inpl!= NULL)

else

{

XERCES_STD_QUALIFIER cerr<< 请求的实施不支持
<< XERCES_STD_QUALIFIER endl;

errorCode = 4;

}

}


XMLPlatformUtils :: Terminate( );

返回errorCode;

}

-

STH

哈顿's Law:只有一个不可侵犯的法律

KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com

Mozilla: http://www.mozilla.org

The short sample program listed below has some features that I find to be
bad style. In particular, they fail to communicate the connection between
names used in this program and the location in which they are declared and
or defined. I''d like to know if there are any features of this code you
believe represents bad programming technique. How would the feature be
better implemented?

/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
* Please visit the following url for the complete license statement:
http://cvs.apache.org/viewcvs.cgi/xm...1.18&view=auto
*/

/*
* $Id: CreateDOMDocument.cpp,v 1.18 2003/12/10 23:48:53 neilg Exp $
*/

/*
* This sample illustrates how you can create a DOM tree in memory.
* It then prints the count of elements in the tree.
*/
//
---------------------------------------------------------------------------
// Includes
//
---------------------------------------------------------------------------
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/dom/DOM.hpp>
#if defined(XERCES_NEW_IOSTREAMS)
#include <iostream>
#else
#include <iostream.h>
#endif

XERCES_CPP_NAMESPACE_USE

//
---------------------------------------------------------------------------
// This is a simple class that lets us do easy (though not terribly
efficient)
// trancoding of char* data to XMLCh data.
//
---------------------------------------------------------------------------
class XStr
{
public :
//
-----------------------------------------------------------------------
// Constructors and Destructor
//
-----------------------------------------------------------------------
XStr(const char* const toTranscode)
{
// Call the private transcoding method
fUnicodeForm = XMLString::transcode(toTranscode);
}

~XStr()
{
XMLString::release(&fUnicodeForm);
}
//
-----------------------------------------------------------------------
// Getter methods
//
-----------------------------------------------------------------------
const XMLCh* unicodeForm() const
{
return fUnicodeForm;
}

private :
//
-----------------------------------------------------------------------
// Private data members
//
// fUnicodeForm
// This is the Unicode XMLCh format of the string.
//
-----------------------------------------------------------------------
XMLCh* fUnicodeForm;
};

#define X(str) XStr(str).unicodeForm()
//
---------------------------------------------------------------------------
// main
//
---------------------------------------------------------------------------

int main(int argC, char* argV[])
{
// Initialize the XML4C2 system.
try
{
XMLPlatformUtils::Initialize();
}

catch(const XMLException& toCatch)
{
char *pMsg = XMLString::transcode(toCatch.getMessage());
XERCES_STD_QUALIFIER cerr << "Error during Xerces-c Initialization
\n"
<< " Exception message:"
<< pMsg;
XMLString::release(&pMsg);
return 1;
}

// Watch for special case help request
int errorCode = 0;
if (argC > 1)
{
XERCES_STD_QUALIFIER cout << "\nUsage:\n"
" CreateDOMDocument\n\n"
"This program creates a new DOM document from scratch in
memory.\n"
"It then prints the count of elements in the tree.\n"
<< XERCES_STD_QUALIFIER endl;
errorCode = 1;
}
if(errorCode) {
XMLPlatformUtils::Terminate();
return errorCode;
}

{
// Nest entire test in an inner block.
// The tree we create below is the same that the XercesDOMParser
would
// have created, except that no whitespace text nodes would be
created.

// <company>
// <product>Xerces-C</product>
// <category idea=''great''>XML Parsing Tools</category>
// <developedBy>Apache Software Foundation</developedBy>
// </company>

DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(X( "Core"));

if (impl != NULL)
{
try
{
DOMDocument* doc = impl->createDocument(
0, // root element namespace
URI.
X("company"), // root element name
0); // document type object
(DTD).

DOMElement* rootElem = doc->getDocumentElement();

DOMElement* prodElem = doc->createElement(X("product"));
rootElem->appendChild(prodElem);

DOMText* prodDataVal = doc->createTextNode(X("Xerces-C"));
prodElem->appendChild(prodDataVal);

DOMElement* catElem = doc->createElement(X("category"));
rootElem->appendChild(catElem);

catElem->setAttribute(X("idea"), X("great"));

DOMText* catDataVal = doc->createTextNode(X("XML Parsing
Tools"));
catElem->appendChild(catDataVal);

DOMElement* devByElem =
doc->createElement(X("developedBy"));
rootElem->appendChild(devByElem);

DOMText* devByDataVal = doc->createTextNode(X("Apache
Software Foundation"));
devByElem->appendChild(devByDataVal);

//
// Now count the number of elements in the above DOM tree.
//

unsigned int elementCount =
doc->getElementsByTagName(X("*"))->getLength();
XERCES_STD_QUALIFIER cout << "The tree just created contains:
" << elementCount
<< " elements." << XERCES_STD_QUALIFIER endl;

doc->release();
}

catch (const DOMException& e)
{
XERCES_STD_QUALIFIER cerr << "DOMException code is: " <<
e.code << XERCES_STD_QUALIFIER endl;
errorCode = 2;
}
catch (...)
{
XERCES_STD_QUALIFIER cerr << "An error occurred creating the
document" << XERCES_STD_QUALIFIER endl;
errorCode = 3;
}
} // (inpl != NULL)
else
{
XERCES_STD_QUALIFIER cerr << "Requested implementation is not
supported" << XERCES_STD_QUALIFIER endl;
errorCode = 4;
}
}

XMLPlatformUtils::Terminate();
return errorCode;
}
--
STH
Hatton''s Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org

推荐答案

Id:CreateDOMDocument.cpp,v 1.18 2003/12/10 23:48:53 neilg Exp
Id: CreateDOMDocument.cpp,v 1.18 2003/12/10 23:48:53 neilg Exp




* /


/ *

*此示例说明了如何在内存中创建DOM树。

*然后打印树中元素的数量。

* /

//

- ------------------------------------------- -------------------------------

//包括

//

---------------------------------------- -----------------------------------

#include< xercesc / util /PlatformUtils.hpp>

#include< xercesc / util / XMLString.hpp>

#include< xercesc / dom / DOM.hpp>

#if定义(XERCES_NEW_IOSTREAMS)

#include< iostream>

#else

#include< iostream.h>

#endif


XERCES_CPP_NAMESPACE_USE


//

------ -------------------------------------------------- -------------------

//这是一个简单的课程,可以让我们轻松完成(虽然不是非常好)

高效)

//将char *数据转码为XMLCh数据。

//

---------- -------------------------------------------------- ---------------

class XStr

{

public:

//

------------------------------------ -----------------------------------

//构造函数和析构函数

//

---------------------------------- -------------------------------------

XStr(const char * const toTranscode)

{

//调用私有转码方法

fUnicodeForm = XMLString :: transcode(toTranscode);

}


~XStr()

{

XMLString :: release(& fUnicodeForm);

}

//

-------------------------- ---------------------------------------------

//吸气方法

//

------------------------- ----------------------------------------------

const XMLCh * unicodeForm()const

{

返回fUnicodeForm;

}


private:

//

---------------------------- -------------------------------------------

//私人数据成员

//

// fUnicodeForm

//这是字符串的Unicode XMLCh格式。

//

------------------- -------------------------------------------------- -

XMLCh * fUnicodeForm;

};


#define X(str)XStr(str).unicodeForm()

//

-------------------------------- -------------------------------------------

// main

//

---------------------------- -----------------------------------------------


int main(int argC,char * argV [])

{

//初始化XML4C2系统。

试试

{

XMLPlatformUtils :: Initialize();

}


catch (const XMLException& toCatch)

{

char * pMsg = XMLString :: transcode(toCatch.getMessage());

XERCES_STD_QUALIFIER cerr<< Xerces-c初始化期间出错

\ n

<< "例外消息:

<< pMsg;

XMLString :: release(& pMsg);

返回1;

}


//观察特殊案例帮助请求

int errorCode = 0;

if(argC> 1)

{

XERCES_STD_QUALIFIER cout<< " \ nUsage:\ n"

" CreateDOMDocument\\\
\ n"

"这个程序从头开始创建一个新的DOM文档

memory.\ n"

然后,它打印树中元素的数量。\ n"

<< XERCES_STD_QUALIFIER endl;

errorCode = 1;

}

if(errorCode){

XMLPlatformUtils :: Terminate( );

返回errorCode;

}


{

//将整个测试嵌套在一个内部块。

//我们在下面创建的树与XercesDOMParser

将创建的
相同,除了没有空格文本节点将是

创建的。


//< company>

//< product> Xerces-C< / product>

//< category idea =''great''> XML解析工具< / category>

//< developedBy> Apache Software Foundation< / developBy>

//< / company>


DOMImplementation * impl =

DOMImplementationRegistry :: getDOMImplementation(X(&) ;核心));


if(impl!= NULL)

{

试试

{

DOMDocument * doc = impl-> createDocument(

0,//根元素名称空间

URI。

X(" company"),//根元素名称

0); //文档类型对象

(DTD)。


DOMElement * rootElem = doc-> getDocumentElement();


DOMElement * prodElem = doc-> createElement(X(" product"));

rootElem-> appendChild(prodElem);


DOMText * prodDataVal = doc-> createTextNode(X(" Xerces-C"));

prodElem-> appendChild(prodDataVal);


DOMElement * catElem = doc-> createElement(X(" category"));

rootElem-> appendChild(catElem);


catElem - > setAttribute(X(" idea"),X(" great"));


DOMText * catDataVal = doc-> createTextNode(X(" XML Parsing)

工具"));

catElem-> appendChild(catDataVal);


DOMElement * devByElem =

doc-> createElement(X(" developedBy"));

rootElem-> appendChild(devByElem);


DOMText * devByDataVal = doc-> createTextNode(X(&qu ot; Apache

Software Foundation"));

devByElem-> appendChild(devByDataVal);


//

//现在计算上面DOM树中元素的数量。

//


unsigned int elementCount =

doc-> getElementsByTagName(X(" *")) - > getLength();

XERCES_STD_QUALIFIER cout<< 刚刚创建的树包含:

<< elementCount

<< "元素"。 << XERCES_STD_QUALIFIER endl;


doc-> release();

}


catch(const DOMException& e )

{

XERCES_STD_QUALIFIER cerr<< DOMException代码是: <<

e.code<< XERCES_STD_QUALIFIER endl;

errorCode = 2;

}

catch(...)

{

XERCES_STD_QUALIFIER cerr<< 创建

文档时出错 << XERCES_STD_QUALIFIER endl;

errorCode = 3;

}

} //(inpl!= NULL)

else

{

XERCES_STD_QUALIFIER cerr<< 请求的实施不支持
<< XERCES_STD_QUALIFIER endl;

errorCode = 4;

}

}


XMLPlatformUtils :: Terminate( );

返回errorCode;

}

-

STH

哈顿's Law:只有一个不可侵犯的法律

KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com

Mozilla: http://www.mozilla.org

*/

/*
* This sample illustrates how you can create a DOM tree in memory.
* It then prints the count of elements in the tree.
*/
//
---------------------------------------------------------------------------
// Includes
//
---------------------------------------------------------------------------
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/dom/DOM.hpp>
#if defined(XERCES_NEW_IOSTREAMS)
#include <iostream>
#else
#include <iostream.h>
#endif

XERCES_CPP_NAMESPACE_USE

//
---------------------------------------------------------------------------
// This is a simple class that lets us do easy (though not terribly
efficient)
// trancoding of char* data to XMLCh data.
//
---------------------------------------------------------------------------
class XStr
{
public :
//
-----------------------------------------------------------------------
// Constructors and Destructor
//
-----------------------------------------------------------------------
XStr(const char* const toTranscode)
{
// Call the private transcoding method
fUnicodeForm = XMLString::transcode(toTranscode);
}

~XStr()
{
XMLString::release(&fUnicodeForm);
}
//
-----------------------------------------------------------------------
// Getter methods
//
-----------------------------------------------------------------------
const XMLCh* unicodeForm() const
{
return fUnicodeForm;
}

private :
//
-----------------------------------------------------------------------
// Private data members
//
// fUnicodeForm
// This is the Unicode XMLCh format of the string.
//
-----------------------------------------------------------------------
XMLCh* fUnicodeForm;
};

#define X(str) XStr(str).unicodeForm()
//
---------------------------------------------------------------------------
// main
//
---------------------------------------------------------------------------

int main(int argC, char* argV[])
{
// Initialize the XML4C2 system.
try
{
XMLPlatformUtils::Initialize();
}

catch(const XMLException& toCatch)
{
char *pMsg = XMLString::transcode(toCatch.getMessage());
XERCES_STD_QUALIFIER cerr << "Error during Xerces-c Initialization
\n"
<< " Exception message:"
<< pMsg;
XMLString::release(&pMsg);
return 1;
}

// Watch for special case help request
int errorCode = 0;
if (argC > 1)
{
XERCES_STD_QUALIFIER cout << "\nUsage:\n"
" CreateDOMDocument\n\n"
"This program creates a new DOM document from scratch in
memory.\n"
"It then prints the count of elements in the tree.\n"
<< XERCES_STD_QUALIFIER endl;
errorCode = 1;
}
if(errorCode) {
XMLPlatformUtils::Terminate();
return errorCode;
}

{
// Nest entire test in an inner block.
// The tree we create below is the same that the XercesDOMParser
would
// have created, except that no whitespace text nodes would be
created.

// <company>
// <product>Xerces-C</product>
// <category idea=''great''>XML Parsing Tools</category>
// <developedBy>Apache Software Foundation</developedBy>
// </company>

DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(X( "Core"));

if (impl != NULL)
{
try
{
DOMDocument* doc = impl->createDocument(
0, // root element namespace
URI.
X("company"), // root element name
0); // document type object
(DTD).

DOMElement* rootElem = doc->getDocumentElement();

DOMElement* prodElem = doc->createElement(X("product"));
rootElem->appendChild(prodElem);

DOMText* prodDataVal = doc->createTextNode(X("Xerces-C"));
prodElem->appendChild(prodDataVal);

DOMElement* catElem = doc->createElement(X("category"));
rootElem->appendChild(catElem);

catElem->setAttribute(X("idea"), X("great"));

DOMText* catDataVal = doc->createTextNode(X("XML Parsing
Tools"));
catElem->appendChild(catDataVal);

DOMElement* devByElem =
doc->createElement(X("developedBy"));
rootElem->appendChild(devByElem);

DOMText* devByDataVal = doc->createTextNode(X("Apache
Software Foundation"));
devByElem->appendChild(devByDataVal);

//
// Now count the number of elements in the above DOM tree.
//

unsigned int elementCount =
doc->getElementsByTagName(X("*"))->getLength();
XERCES_STD_QUALIFIER cout << "The tree just created contains:
" << elementCount
<< " elements." << XERCES_STD_QUALIFIER endl;

doc->release();
}

catch (const DOMException& e)
{
XERCES_STD_QUALIFIER cerr << "DOMException code is: " <<
e.code << XERCES_STD_QUALIFIER endl;
errorCode = 2;
}
catch (...)
{
XERCES_STD_QUALIFIER cerr << "An error occurred creating the
document" << XERCES_STD_QUALIFIER endl;
errorCode = 3;
}
} // (inpl != NULL)
else
{
XERCES_STD_QUALIFIER cerr << "Requested implementation is not
supported" << XERCES_STD_QUALIFIER endl;
errorCode = 4;
}
}

XMLPlatformUtils::Terminate();
return errorCode;
}
--
STH
Hatton''s Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org


Steven T. Hatton写道:
Steven T. Hatton wrote:
下面列出的简短示例程序有一些我发现的功能
糟糕的风格。特别是,它们无法传达此程序中使用的
名称与声明和定义它们的位置之间的联系。我想知道这段代码是否有任何功能,你相信它代表了糟糕的编程技巧。如何更好地实现该功能?

/ *
* Apache软件许可证,版本1.1
*版权所有(c)1999- 2003年Apache软件基金会。所有权利
*保留。
*请访问以下网址获取完整的许可声明:
http://cvs.apache.org/viewcvs.cgi/xm ... 1.18& view = auto * /
---------------------------------- ----------------------------------------- //包括
//

------------------------------------------ --------------------------------- #include< xercesc / util / PlatformUtils.hpp>
# include< xercesc / util / XMLString.hpp>
#include< xercesc / dom / DOM.hpp>
#if defined(XERCES_NEW_IOSTREAMS)
#include< iostream>
#else
#include< iostream.h>
#endif


这是什么?它在语法上是C ++的一部分吗?

XERCES_CPP_NAMESPACE_USE
//
The short sample program listed below has some features that I find to be
bad style. In particular, they fail to communicate the connection between
names used in this program and the location in which they are declared and
or defined. I''d like to know if there are any features of this code you
believe represents bad programming technique. How would the feature be
better implemented?

/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
* Please visit the following url for the complete license statement:
http://cvs.apache.org/viewcvs.cgi/xm...1.18&view=auto */ --------------------------------------------------------------------------- // Includes
//
--------------------------------------------------------------------------- #include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/dom/DOM.hpp>
#if defined(XERCES_NEW_IOSTREAMS)
#include <iostream>
#else
#include <iostream.h>
#endif
What is this? Is it grammatically part of C++?
XERCES_CPP_NAMESPACE_USE

//



在第二级#inclusion我发现了这个:< br $>

//

----------------------------- ----------------------------------------------

//如果编译器支持,则定义名称空间符号。

//

----------------- -------------------------------------------------- --------

#if定义(XERCES_HAS_CPP_NAMESPACE)

#define XERCES_CPP_NAMESPACE_BEGIN命名空间XERCES_CPP_NAMESPACE {

#define XERCES_CPP_NAMESPACE_END}

#define XERCES_CPP_NAMESPACE_USE使用命名空间XERCES_CPP_NAMESPACE;

#define XERCES_CPP_NAMESPACE_QUALIFIER XERCES_CPP_NAMESPACE ::


命名空间XERCES_CPP_NAMESPACE {}

名称空间xercesc = XERCES_CPP_NAMESPACE;

#else

#define XERCES_CPP_NAMESPACE_BEGIN

#define XERCES_CPP_NAMESPACE_END

#define XERCES _CPP_NAMESPACE_USE

#define XERCES_CPP_NAMESPACE_QUALIFIER

#endif


我发现这很令人沮丧。

这是C编程,而不是C ++。


At a second level of #inclusion I found this:

//
---------------------------------------------------------------------------
// Define namespace symbols if the compiler supports it.
//
---------------------------------------------------------------------------
#if defined(XERCES_HAS_CPP_NAMESPACE)
#define XERCES_CPP_NAMESPACE_BEGIN namespace XERCES_CPP_NAMESPACE {
#define XERCES_CPP_NAMESPACE_END }
#define XERCES_CPP_NAMESPACE_USE using namespace XERCES_CPP_NAMESPACE;
#define XERCES_CPP_NAMESPACE_QUALIFIER XERCES_CPP_NAMESPACE::

namespace XERCES_CPP_NAMESPACE { }
namespace xercesc = XERCES_CPP_NAMESPACE;
#else
#define XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_USE
#define XERCES_CPP_NAMESPACE_QUALIFIER
#endif

I find that downright depressing.
This is C programming, not C++.

#define X(str)XStr(str).unicodeForm()
#define X(str) XStr(str).unicodeForm()




-

STH

哈顿定律:只有一个不可侵犯的法律

KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com

Mozilla: http://www.mozilla.org



--
STH
Hatton''s Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org


这篇关于另一个Critia的代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆