libopc
Macros | Typedefs | Functions
relation.h File Reference
#include <opc/config.h>

Go to the source code of this file.

Macros

#define OPC_RELATION_INVALID   (-1)
 

Typedefs

typedef opc_uint32_t opcRelation
 

Functions

opcRelation opcRelationFind (opcContainer *container, opcPart part, const xmlChar *relationId, const xmlChar *mimeType)
 
opc_error_t opcRelationDelete (opcContainer *container, opcPart part, const xmlChar *relationId, const xmlChar *mimeType)
 
opcRelation opcRelationFirst (opcContainer *container, opcPart part)
 
opcRelation opcRelationNext (opcContainer *container, opcPart part, opcRelation relation)
 
opcPart opcRelationGetInternalTarget (opcContainer *container, opcPart part, opcRelation relation)
 
const xmlChar * opcRelationGetExternalTarget (opcContainer *container, opcPart part, opcRelation relation)
 
const xmlChar * opcRelationGetType (opcContainer *container, opcPart part, opcRelation relation)
 
void opcRelationGetInformation (opcContainer *container, opcPart part, opcRelation relation, const xmlChar **prefix, opc_uint32_t *counter, const xmlChar **type)
 
opc_uint32_t opcRelationAdd (opcContainer *container, opcPart src, const xmlChar *rid, opcPart dest, const xmlChar *type)
 
opc_uint32_t opcRelationAddExternal (opcContainer *container, opcPart src, const xmlChar *rid, const xmlChar *target, const xmlChar *type)
 

Macro Definition Documentation

#define OPC_RELATION_INVALID   (-1)

Constant which represents an invalid relation.

Examples:
opc_generate.c, opc_relation.c, and opc_type.c.

Typedef Documentation

Indentifier for an OPC relation.

Function Documentation

opc_uint32_t opcRelationAdd ( opcContainer container,
opcPart  src,
const xmlChar *  rid,
opcPart  dest,
const xmlChar *  type 
)

Add a relation to container from src part to dest part with id rid and type type.

opc_uint32_t opcRelationAddExternal ( opcContainer container,
opcPart  src,
const xmlChar *  rid,
const xmlChar *  target,
const xmlChar *  type 
)

Add an external relation to container from src part to target URL with id rid and type type.

opc_error_t opcRelationDelete ( opcContainer container,
opcPart  part,
const xmlChar *  relationId,
const xmlChar *  mimeType 
)

Deleted the relation from the container.

See also
opcRelationFind.
opcRelation opcRelationFind ( opcContainer container,
opcPart  part,
const xmlChar *  relationId,
const xmlChar *  mimeType 
)

Find a relation originating from part in container with relationId and/or mimeType. If part is OPC_PART_INVALID then part represents the root part.

Parameters
[in]relationIdThe relationId (e.g. "rId1") or NULL.
[in]mimeTypeThe mimeType or NULL.
Examples:
opc_relation.c, and opc_type.c.
opcRelation opcRelationFirst ( opcContainer container,
opcPart  part 
)

Returns the first relation. The following code will dump all relations:

1 for(opcPart part=opcPartGetFirst(c);OPC_PART_INVALID!=part;part=opcPartGetNext(c, part)) {
2  for(opcRelation rel=opcRelationFirst(part, c);
3  OPC_PART_INVALID!=rel;
4  rel=opcRelationNext(c, rel)) {
5  opcPart internal_target=opcRelationGetInternalTarget(c, part, rel);
6  const xmlChar *external_target=opcRelationGetExternalTarget(c, part, rel);
7  const xmlChar *target=(NULL!=internal_target?internal_target:external_target);
8  const xmlChar *prefix=NULL;
9  opc_uint32_t counter=-1;
10  const xmlChar *type=NULL;
11  opcRelationGetInformation(c, part, rel, &prefix, &counter, &type);
12  if (-1==counter) { // no counter after prefix
13  printf("%s;%s;%s;%s\n", part, prefix, target, type);
14  } else {
15  printf("%s;%s%i;%s;%s\n", part, prefix, counter, target, type);
16  }
17  }
18 }
Examples:
opc_generate.c, and opc_relation.c.
const xmlChar* opcRelationGetExternalTarget ( opcContainer container,
opcPart  part,
opcRelation  relation 
)

Returns the external target or NULL if it is an internal target. The string is interned. Must not be freed.

See also
opcRelationGetExternalTarget
Examples:
opc_generate.c.
void opcRelationGetInformation ( opcContainer container,
opcPart  part,
opcRelation  relation,
const xmlChar **  prefix,
opc_uint32_t counter,
const xmlChar **  type 
)

Get information about a relation.

See also
opcRelationFirst
Examples:
opc_generate.c, and opc_relation.c.
opcPart opcRelationGetInternalTarget ( opcContainer container,
opcPart  part,
opcRelation  relation 
)

Returns the internal target.

Note
To test for an external target use opcRelationGetExternalTarget.
See also
opcRelationGetExternalTarget
Examples:
opc_generate.c, opc_relation.c, and opc_type.c.
const xmlChar* opcRelationGetType ( opcContainer container,
opcPart  part,
opcRelation  relation 
)

Returns the relations type. The string is interned. Must not be freed.

opcRelation opcRelationNext ( opcContainer container,
opcPart  part,
opcRelation  relation 
)