本文整理汇总了C++中XObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ XObjectPtr类的具体用法?C++ XObjectPtr怎么用?C++ XObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
XObjectPtr
FunctionFormatNumber::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* locator) const
{
assert(arg1.null() == false && arg2.null() == false);
const double theNumber = arg1->num();
const XalanDOMString& thePattern = arg2->str();
typedef XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
GetAndReleaseCachedString theString(executionContext);
executionContext.formatNumber(
theNumber,
thePattern,
theString.get(),
context,
locator);
return executionContext.getXObjectFactory().createString(theString);
}
示例2: getTotal
/*
* Get the total of the second and third arguments.
*/
inline double
getTotal(
XalanDOMString::size_type theSourceStringLength,
double theSecondArgValue,
const XObjectPtr& arg3)
{
// Total the second and third arguments. If the third argument is
// missing, make it the length of the string + 1 (for XPath
// indexing style).
if (arg3.null() == true)
{
return double(theSourceStringLength + 1);
}
else
{
const double theRoundedValue =
DoubleSupport::round(DoubleSupport::add(theSecondArgValue, arg3->num()));
// If there's overflow, then we should return the length of the string + 1.
if (DoubleSupport::isPositiveInfinity(theRoundedValue) == true)
{
return double(theSourceStringLength + 1);
}
else
{
return theRoundedValue;
}
}
}
示例3: execute
XObjectPtr CExternalFunction::execute( XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const Locator* /* locator */) const
{
assert(arg1.null() == false);
const XalanDOMString& arg = arg1->str();
//convert XalanDOMString (implemented as unsigned short*) into StringBuffer
StringBuffer sbInput;
sbInput.ensureCapacity(arg.length()+1);
size32_t len = arg.length();
for (size32_t i=0; i < len; i++)
sbInput.append( (char) arg[i]);
StringBuffer sbOutput;
try
{
(*m_userFunction)(sbOutput, sbInput.str(), m_pTransform);
}
catch (IException* e)
{
StringBuffer msg;
e->errorMessage(msg);
e->Release();
}
catch (...)
{
}
XalanDOMString xdsOutput( sbOutput.str() );
return executionContext.getXObjectFactory().createString( xdsOutput );
}
示例4: assert
XObjectPtr
FunctionLang::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const LocatorType* /* locator */) const
{
assert(arg1.null() == false);
const XalanNode* parent = context;
bool fMatch = false;
const XalanDOMString& lang = arg1->str();
while(0 != parent)
{
if(XalanNode::ELEMENT_NODE == parent->getNodeType())
{
const XalanElement* const theElementNode =
#if defined(XALAN_OLD_STYLE_CASTS)
(const XalanElement*)parent;
#else
static_cast<const XalanElement*>(parent);
#endif
const XalanDOMString& langVal =
theElementNode->getAttributeNS(
DOMServices::s_XMLNamespaceURI,
s_attributeName);
if(0 != length(langVal))
{
XPathExecutionContext::GetAndReleaseCachedString theGuard1(executionContext);
XPathExecutionContext::GetAndReleaseCachedString theGuard2(executionContext);
if(startsWith(toLowerCaseASCII(langVal, theGuard1.get()), toLowerCaseASCII(lang, theGuard2.get())))
{
const XalanDOMString::size_type valLen = length(lang);
if(length(langVal) == valLen ||
charAt(langVal, valLen) == XalanUnicode::charHyphenMinus)
{
fMatch = true;
break;
}
}
}
}
parent = DOMServices::getParentOfNode(*parent);
}
return executionContext.getXObjectFactory().createBoolean(fMatch);
}
示例5: assert
XObjectPtr
FunctionSubstring::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* locator) const
{
assert(arg1.null() == false && arg2.null() == false);
return execute(executionContext, context, arg1, arg2, s_nullXObjectPtr, locator);
}
示例6: assert
XObjectPtr
FunctionElementAvailable::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const LocatorType* locator) const
{
assert(arg1.null() == false);
return executionContext.getXObjectFactory().createBoolean(
executionContext.elementAvailable(arg1->str(), locator));
}
示例7: createEmptyString
XObjectPtr
FunctionSubstringBefore::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* /* locator */) const
{
assert(arg1.null() == false && arg2.null() == false);
const XalanDOMString& theFirstString = arg1->str();
const XalanDOMString::size_type theFirstStringLength = length(theFirstString);
if (theFirstStringLength == 0)
{
return createEmptyString(executionContext);
}
else
{
const XalanDOMString& theSecondString = arg2->str();
const XalanDOMString::size_type theSecondStringLength = length(theSecondString);
if (theSecondStringLength == 0)
{
return createEmptyString(executionContext);
}
else
{
const XalanDOMString::size_type theIndex = indexOf(theFirstString,
theSecondString);
if (theIndex == theFirstStringLength)
{
return createEmptyString(executionContext);
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theResult(executionContext);
XalanDOMString& theString = theResult.get();
theString.assign(
toCharArray(theFirstString),
theIndex);
// Create a string of the appropriate length...
return executionContext.getXObjectFactory().createString(theResult);
}
}
}
}
示例8: TestStringResult
bool
TestStringResult(
XPathProcessor& theXPathProcessor,
XPath& theXPath,
XPathConstructionContext& theXPathConstructionContext,
const XalanDOMString& theXPathString,
PrintWriter& thePrintWriter,
const XalanDOMString& theExpectedResult,
XalanNode* theContextNode,
const PrefixResolver& thePrefixResolver,
const NodeRefListBase& theContextNodeList,
XPathExecutionContext& theExecutionContext)
{
bool fError = false;
const XObjectPtr theResult =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
theXPath,
theXPathString,
theContextNode,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
thePrintWriter.print("Execution of XPath ");
thePrintWriter.print(theXPathString);
if (equals(theResult->str(), theExpectedResult) == true)
{
thePrintWriter.println(" succeeded.");
thePrintWriter.print("The result was \"");
thePrintWriter.print(theResult->str());
thePrintWriter.println("\".");
}
else
{
fError = true;
thePrintWriter.println(" failed!");
thePrintWriter.print("The expected result was \"");
thePrintWriter.print(theExpectedResult);
thePrintWriter.println("\".");
thePrintWriter.print("The actual result was \"");
thePrintWriter.print(theResult->str());
thePrintWriter.println("\".");
}
return fError;
}
示例9: assert
XObjectPtr
FunctionStartsWith::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2,
const Locator* const /* locator */) const
{
assert(arg1.null() == false && arg2.null() == false);
const bool fStartsWith =
startsWith(
arg1->str(executionContext),
arg2->str(executionContext));
return executionContext.getXObjectFactory().createBoolean(fStartsWith);
}
示例10: assert
XObjectPtr
FunctionString::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const LocatorType* /* locator */) const
{
assert(arg1.null() == false);
if (arg1->getType() == XObject::eTypeString)
{
// Since XObjects are reference counted, just return the
// argument.
return arg1;
}
else
{
return executionContext.getXObjectFactory().createStringAdapter(arg1);
}
}
示例11: assert
XObjectPtr
FunctionSample::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2,
const Locator* /* locator */) const
{
assert(arg1.null() == false);
assert(arg2.null() == false);
XalanDOMString path;
arg1->str(path);
const bool bLinux = arg2->boolean();
XalanDOMChar dchOld;
XalanDOMChar dchNew;
if (bLinux)
{
dchOld = '\\';
dchNew = '/';
}
else
{
dchOld = '/';
dchOld = '\\';
}
int len = path.length();
for (int i=0; i<len; i++)
if (path[i] == dchOld)
path[i] = dchNew;
return executionContext.getXObjectFactory().createString(path);
}
示例12: XalanDocumentFragmentXNodeSetBaseProxy
XalanDocumentFragmentXNodeSetBaseProxy(const XObjectPtr& theXObject) :
XNodeSetBase(),
m_xobject(theXObject),
m_proxy(theXObject->rtree())
{
}
示例13: TestBooleanResult
bool
TestBooleanResult(
XPathProcessor& theXPathProcessor,
XPath& theXPath,
XPathConstructionContext& theXPathConstructionContext,
const XalanDOMString& theXPathString,
PrintWriter& thePrintWriter,
bool theExpectedResult,
XalanNode* theContextNode,
const PrefixResolver& thePrefixResolver,
const NodeRefListBase& theContextNodeList,
XPathExecutionContext& theExecutionContext)
{
bool fError = false;
const XObjectPtr theResult =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
theXPath,
theXPathString,
theContextNode,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
bool fDump = false;
if (fDump == true)
{
thePrintWriter.println();
thePrintWriter.println();
theXPath.getExpression().dumpOpCodeMap(thePrintWriter);
thePrintWriter.println();
theXPath.getExpression().dumpTokenQueue(thePrintWriter);
thePrintWriter.println();
thePrintWriter.println();
}
thePrintWriter.print("Execution of XPath ");
thePrintWriter.print(theXPathString);
if (theResult->boolean() == theExpectedResult)
{
thePrintWriter.println(" succeeded.");
thePrintWriter.print("The result was ");
thePrintWriter.print(theResult->boolean());
thePrintWriter.println(".");
}
else
{
fError = true;
thePrintWriter.println(" failed!");
thePrintWriter.print("The expected result was \"");
thePrintWriter.print(theExpectedResult);
thePrintWriter.println("\".");
thePrintWriter.print("The actual result was \"");
thePrintWriter.print(theResult->boolean());
thePrintWriter.println("\".");
}
return fError;
}
示例14: FindContextNode
XalanNode*
FindContextNode(
XPathProcessor& theXPathProcessor,
XPathEnvSupport& theXPathEnvSupport,
DOMSupport& theDOMSupport,
XPathFactory& theXPathFactory,
XalanDocument* theDocument,
const XalanDOMString& theContextNodeMatchPattern,
PrintWriter& thePrintWriter,
XPathExecutionContext& theExecutionContext)
{
XalanNode* theResult = 0;
MemoryManagerType& theMemoryManager =
theExecutionContext.getMemoryManager();
XPath* const theXPath = theXPathFactory.create();
XPathConstructionContextDefault theXPathConstructionContext;
XPathGuard theGuard(
theXPathFactory,
theXPath);
XalanElement* theNamespaceContext = 0;
ElementPrefixResolverProxy thePrefixResolver(theNamespaceContext, theXPathEnvSupport, theDOMSupport);
NodeRefList theContextNodeList(theMemoryManager);
const XObjectPtr theXObject =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
*theXPath,
theContextNodeMatchPattern,
theDocument,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
try
{
assert(theXObject.null() == false);
const NodeRefListBase& theResultList =
theXObject->nodeset();
if (theResultList.getLength() == 0)
{
thePrintWriter.print("FindContextNode: Unable to find context node using select \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
thePrintWriter.println("FindContextNode: No nodes matched the pattern.");
}
else if (theResultList.getLength() != 1)
{
thePrintWriter.print("FindContextNode: Unable to find context node using select \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
thePrintWriter.println("FindContextNode: More than one node matched the pattern.");
}
else
{
theResult = theResultList.item(0);
}
}
catch(...)
{
thePrintWriter.print("FindContextNode: Error executing match pattern \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
}
return theResult;
}
示例15: display
void display()
{
try
{
Render::start();
Render::LIGHT->on();
static double t = 0.0;
t += 0.03333;
GLfloat amb[4] = {0.25f, 0.20f, 0.07f, 1.f};
GLfloat dif[4] = {0.75f, 0.61f, 0.23f, 1.f};
GLfloat spe[4] = {0.63f, 0.56f, 0.37f, 1.f};
GLfloat shine = 51.2f;
glTranslated(0.0, 1.0, 0.0);
glRotated(90.0, 1.0, 0.0, 0.0);
Material::setMaterial(amb, dif, spe, shine);
glutSolidTeapot(0.1);
std::string path = "/home/daichi/Work/catkin_ws/src/ahl_ros_pkgs/ahl_common/wrapper/gl_wrapper/blender/";
static XObjectPtr lwr1 = XObjectPtr(new XObject(path + "lwr07.x"));
static XObjectPtr lwr2 = XObjectPtr(new XObject(path + "lwr07.x"));
static XObjectPtr lwr3 = XObjectPtr(new XObject(path + "lwr07.x"));
static SimpleObjectPtr grid = SimpleObjectPtr(new Grid(20, 20, 0.5));
lwr1->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr1->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr1->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr1->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr2->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr2->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr2->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr3->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr3->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr3->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
glLoadIdentity();
lwr1->display();
glLoadIdentity();
glTranslated(0.0, -0.6, 0.0);
lwr2->display();
glLoadIdentity();
glTranslated(0.0, -1.2, 0.0);
lwr3->display();
glLoadIdentity();
grid->setColor(0, 0, 255);
grid->setPosition(0.0, 0.0, 0.0);
grid->display();
/*
gl_wrapper::RightHandPtr right_hand;
right_hand = RightHandPtr(new RightHand("/home/daichi/work/catkin_ws/src/gl_wrapper/righthand.cfg"));
right_hand->display();
*/
Render::end();
}
catch(Exception& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(FatalException& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(std::exception& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(...)
{
ROS_ERROR_STREAM("display : Unknown exception was thrown.");
exit(1);
}
}