- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten - svcTabCommon: Export-Header-Fix via Fallback-Target - TrainingAreaBase: Stub-Header für BUILD_RTI=OFF - ddsfts: Include-Pfad und Dependency-Fixes - BUILD_RTI=OFF Compilation vollständig unterstützt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
385 lines
10 KiB
C
385 lines
10 KiB
C
/*
|
|
* Copyright (c) 2007-2024 Real-Time Innovations, Inc. All rights reserved.
|
|
* No duplications, whole or partial, manual or electronic, may be made
|
|
* without express written permission. Any such copies, or revisions thereof,
|
|
* must display this notice unaltered.
|
|
* This code contains trade secrets of Real-Time Innovations, Inc.
|
|
*/
|
|
|
|
#ifndef rtixml_object_h
|
|
#define rtixml_object_h
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
/* XML OBJECT CLASS --------------------------------------------------- */
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
/*e \file
|
|
XML object
|
|
*/
|
|
|
|
/*e \defgroup RTIXMLObjectClass RTIXMLObject
|
|
\ingroup RTIXMLModule
|
|
@brief The parsing process will create a DOM containing a set of RTIXMLObjects.
|
|
|
|
The parser creates RTIXMLObjects using the associated RTIXMLExtensionClass.
|
|
|
|
RTIXMLObject is an abstract class. The user must implement derived classes
|
|
by inheriting from RTIXMLObject. Once the derived class is created,
|
|
it must be registered with the parser using a RTIXMLExtensionClass.
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
/* INCLUDES, DEFINES ---------------------------------------------------- */
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
#include "rtixml/rtixml_dll.h"
|
|
#include "osapi/osapi_type.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define RTIXML_OBJECT_MAX_NAME_LENGTH 512
|
|
#define RTIXML_ANONYMOUS_OBJECT_PREFIX_STR "_rti_anonymous_"
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
/* STRUCTURES ----------------------------------------------------------- */
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
*/
|
|
struct RTIXMLExtensionClass;
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
*/
|
|
struct RTIXMLObject;
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
/* METHODS -------------------------------------------------------------- */
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Initializes a RTIXMLObject
|
|
|
|
This must be the first method called in the initialize implementation of a
|
|
derived class.
|
|
|
|
@pre self is not NULL
|
|
@pre extensionClass is not NULL
|
|
|
|
@param self \b In. Pointer to object.
|
|
@param extensionClass \b In. Extension class.
|
|
The object is taken a loan on the extension class.
|
|
The extension class should not be deleted before the object,
|
|
@param parentObject \b In. The parent of the object that is going to be
|
|
initialized. If the object is the root object of a DOM, parentObject should be
|
|
NULL.
|
|
@param name \b In. The object name.
|
|
@param name \b In. The name of the base object.
|
|
|
|
@return RTI_TRUE if success. Otherwise, RTI_FALSE.
|
|
|
|
@see RTIXMLParser_finalize
|
|
*/
|
|
extern RTIXMLDllExport RTIBool RTIXMLObject_initialize(
|
|
struct RTIXMLObject *self,
|
|
const struct RTIXMLExtensionClass *extensionClass,
|
|
const struct RTIXMLObject *parentObject,
|
|
const char *name,
|
|
const char *base_name);
|
|
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Finalizes a RTIXMLObject
|
|
|
|
This method releases the resources associated to the input RTIXMLObject.
|
|
|
|
This must be the last method called in the finalize implementation of a
|
|
derived class.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Pointer to a RTIXMLObject.
|
|
|
|
@see RTIXMLParser_initialize
|
|
*/
|
|
extern RTIXMLDllExport void RTIXMLObject_finalize(struct RTIXMLObject *self);
|
|
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Lookup an existing object based on its name.
|
|
|
|
The search start from the input object.
|
|
|
|
@pre self is not NULL
|
|
@pre name is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param name \b In. The name of the object to lookup.
|
|
|
|
@return The object if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_lookUp(
|
|
struct RTIXMLObject *self,
|
|
const char *name);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
* @brief Gets the previous sibling of the input object.
|
|
*
|
|
* @pre self is not NULL
|
|
*
|
|
* @param self \b In. Object.
|
|
*
|
|
* @return The previous sibling if it exists. Otherwise, NULL. We return void * to
|
|
* be consistent with REDAInlineList_getPrev.
|
|
*
|
|
* @see RTIXMLObject_getNextSibling
|
|
*/
|
|
extern RTIXMLDllExport void * RTIXMLObject_getPrevSibling(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
*
|
|
* @brief Gets the next sibling of the input object.
|
|
*
|
|
* @pre self is not NULL
|
|
*
|
|
* @param self \b In. Object.
|
|
*
|
|
* @return The next sibling if it exists. Otherwise, NULL. We return void * to
|
|
* be consistent with REDAInlineList_getNext.
|
|
*
|
|
* @see RTIXMLObject_getPrevSibling
|
|
*/
|
|
extern RTIXMLDllExport void * RTIXMLObject_getNextSibling(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
*
|
|
* @brief Gets the first child of the input object.
|
|
*
|
|
* @pre self is not NULL.
|
|
*
|
|
* @param self \b In. Object.
|
|
*
|
|
* @return The first child if it exists. Otherwise, NULL. We return void * to
|
|
* be consistent with REDAInlineList_getFirst.
|
|
*/
|
|
extern RTIXMLDllExport void * RTIXMLObject_getFirstChild(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
*
|
|
* @brief Gets the last child of the input object.
|
|
*
|
|
* @pre self is not NULL.
|
|
*
|
|
* @param self \b In. Object.
|
|
*
|
|
* @return The last child if it exists. Otherwise, NULL. We return void * to
|
|
* be consistent with REDAInlineList_getLast.
|
|
*/
|
|
extern RTIXMLDllExport void * RTIXMLObject_getLastChild(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Returns the number of children of the input object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The number of children of the input object
|
|
*/
|
|
extern RTIXMLDllExport int RTIXMLObject_getChildCount(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Returns the root of the input object.
|
|
|
|
@pre self is not NULL.
|
|
|
|
@param self \b In. Object.
|
|
|
|
@see RTIXMLObject_getParent
|
|
|
|
@return The root if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getRoot(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Gets the tag name associated to the input object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The tag name of the object if success. Otherwise, NULL.
|
|
|
|
@see RTIXMLObject_getName
|
|
*/
|
|
extern RTIXMLDllExport const char * RTIXMLObject_getTagName(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Returns the name of the input object.
|
|
|
|
The name of an object is specified with the XML attribute 'name'
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The name of the object if success. Otherwise, NULL.
|
|
|
|
@see RTIXMLObject_getTagName
|
|
*/
|
|
extern RTIXMLDllExport const char * RTIXMLObject_getName(
|
|
const struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Gets the parent of the input object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The parent XML object if it exists. Otherwise, NULL.
|
|
|
|
@see RTIXMLObject_getRoot
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getParent(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Gets the base object of the input object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The base XML object if it exists. Otherwise, NULL.
|
|
|
|
@see RTIXMLObject_getParent
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getBase(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Gets the extension class of the input object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The extension class.
|
|
*/
|
|
extern RTIXMLDllExport
|
|
struct RTIXMLExtensionClass * RTIXMLObject_getExtensionClass(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
@brief Gets the fully qualified name of an object.
|
|
|
|
@pre self is not NULL
|
|
|
|
@param self \b In. Object.
|
|
|
|
@return The fully qualified name or NULL if there is an error.
|
|
*/
|
|
extern RTIXMLDllExport const char * RTIXMLObject_getFullyQualifiedName(
|
|
struct RTIXMLObject *self);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Looks up a child by its name
|
|
|
|
@pre self is not NULL.
|
|
@pre childName is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param childName \b In. Name of the child
|
|
|
|
@return The child with the give name if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_lookUpChild(
|
|
struct RTIXMLObject *self,
|
|
const char *childName);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Gets the first child of the input object with the given tag name
|
|
|
|
@pre self is not NULL.
|
|
@pre childTagName is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param childTagName \b In. Tag name of the child
|
|
|
|
@return The first child with the given tag if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getFirstChildWithTag(
|
|
struct RTIXMLObject *self,
|
|
const char *childTagName);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Gets the next sibling of the input object with the given tag name
|
|
|
|
@pre self is not NULL.
|
|
@pre childTagName is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param siblingTagName \b In. Tag name of the sibling
|
|
|
|
@return The next sibling with the given tag if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getNextSiblingWithTag(
|
|
struct RTIXMLObject *self,
|
|
const char *siblingTagName);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Gets the previus sibling of the input object with the given tag name
|
|
|
|
@pre self is not NULL.
|
|
@pre childTagName is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param siblingTagName \b In. Tag name of the sibling
|
|
|
|
@return The previous sibling with the given tag if it exists. Otherwise, NULL.
|
|
*/
|
|
extern RTIXMLDllExport struct RTIXMLObject * RTIXMLObject_getPrevSiblingWithTag(
|
|
struct RTIXMLObject *self,
|
|
const char *siblingTagName);
|
|
|
|
/*e \ingroup RTIXMLObjectClass
|
|
|
|
@brief Adds a child to the current object in the internal tree representation
|
|
|
|
@pre self is not NULL
|
|
@pre childObject is not NULL
|
|
|
|
@param self \b In. Object.
|
|
@param childObject \b In. The child object to insert.
|
|
|
|
@return RTI_TRUE if the insertion was successful. RTI_FALSE otherwise.
|
|
*/
|
|
extern RTIXMLDllExport RTIBool RTIXMLObject_addChild(
|
|
struct RTIXMLObject *self,
|
|
struct RTIXMLObject *childObject);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
#include "rtixml/rtixml_object_impl.h"
|
|
|
|
#endif /* rtixml_object_h */
|