|
LibreDWG API
0.13.3
LibreDWG API - The DWG Library
|
#include "config.h"#include <string.h>#include <stdlib.h>#include <assert.h>#include "common.h"#include "dynapi.h"#include "logging.h"#include "decode.h"#include "dwg.h"#include "bits.h"Data Structures | |
| struct | _name_type_fields |
| struct | _name_subclass_fields |
| struct | _name_subclasses |
| struct | _name |
Macros | |
| #define | DWG_LOGLEVEL loglevel |
| #define | NUM_NAME_TYPES ARRAY_SIZE(dwg_name_types) |
| #define | NUM_SUBCLASSES ARRAY_SIZE(dwg_list_subclasses) |
| #define | SET_HDR_FLAGS(name, bit, inverse) |
Functions | |
| Dwg_Object * | dwg_obj_generic_to_object (const void *restrict obj, int *restrict error) |
| bool | is_dwg_entity (const char *name) |
| bool | is_dwg_object (const char *name) |
| const Dwg_DYNAPI_field * | dwg_dynapi_entity_fields (const char *name) |
| const Dwg_DYNAPI_field * | dwg_dynapi_subclass_fields (const char *restrict name) |
| const Dwg_DYNAPI_field * | dwg_dynapi_common_entity_fields (void) |
| const Dwg_DYNAPI_field * | dwg_dynapi_common_object_fields (void) |
| const Dwg_DYNAPI_field * | dwg_dynapi_entity_field (const char *restrict name, const char *restrict field) |
| const Dwg_DYNAPI_field * | dwg_dynapi_subclass_field (const char *restrict name, const char *restrict field) |
| const Dwg_DYNAPI_field * | dwg_dynapi_header_field (const char *restrict fieldname) |
| const Dwg_DYNAPI_field * | dwg_dynapi_common_entity_field (const char *restrict fieldname) |
| const Dwg_DYNAPI_field * | dwg_dynapi_common_object_field (const char *restrict fieldname) |
| const Dwg_DYNAPI_field * | dwg_dynapi_field_dxf (const Dwg_DYNAPI_field *restrict fields, const int dxf, int *restrict unique) |
| int | dwg_dynapi_entity_size (const char *restrict name) |
| int | dwg_dynapi_subclass_size (const char *restrict name) |
| bool | dwg_dynapi_entity_value (void *restrict _obj, const char *restrict name, const char *restrict fieldname, void *restrict out, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_entity_utf8text (void *restrict _obj, const char *restrict name, const char *restrict fieldname, char **restrict out, int *isnew, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_header_value (const Dwg_Data *restrict dwg, const char *restrict fieldname, void *restrict out, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_header_utf8text (const Dwg_Data *restrict dwg, const char *restrict fieldname, char **restrict out, int *isnew, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_common_value (void *restrict _obj, const char *restrict fieldname, void *restrict out, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_common_utf8text (void *restrict _obj, const char *restrict fieldname, char **restrict out, int *isnew, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_entity_set_value (void *restrict _obj, const char *restrict name, const char *restrict fieldname, const void *restrict value, const bool is_utf8) |
| bool | dwg_dynapi_header_set_value (Dwg_Data *restrict dwg, const char *restrict fieldname, const void *restrict value, const bool is_utf8) |
| bool | dwg_dynapi_common_set_value (void *restrict _obj, const char *restrict fieldname, const void *restrict value, const bool is_utf8) |
| bool | dwg_dynapi_subclass_value (const void *restrict ptr, const char *restrict subclass, const char *restrict fieldname, void *restrict out, Dwg_DYNAPI_field *restrict fp) |
| bool | dwg_dynapi_subclass_set_value (Dwg_Data *restrict dwg, const void *restrict ptr, const char *restrict subclass, const char *restrict fieldname, const void *restrict value, const bool is_utf8) |
| bool | dwg_dynapi_field_get_value (const void *restrict ptr, const Dwg_DYNAPI_field *restrict field, void *restrict out) |
| bool | dwg_dynapi_field_set_value (const Dwg_Data *restrict dwg, void *restrict ptr, const Dwg_DYNAPI_field *restrict field, const void *restrict value, const bool is_utf8) |
| char * | dwg_dynapi_handle_name (const Dwg_Data *restrict dwg, Dwg_Object_Ref *restrict hdl, int *alloced) |
| int | _fields_size_sum (const Dwg_DYNAPI_field *restrict fields) |
| int | dwg_dynapi_fields_size (const char *restrict name) |
| char * | dwg_dynapi_subclass_name (const char *restrict type) |
| bool | dwg_has_subclass (const char *restrict classname, const char *restrict subclass) |
| bool | dwg_dynapi_is_angle (const char *restrict name, const char *restrict fieldname) |
| bool | dwg_dynapi_is_float (const Dwg_DYNAPI_field *f) |
| #define DWG_LOGLEVEL loglevel |
| #define NUM_NAME_TYPES ARRAY_SIZE(dwg_name_types) |
| #define NUM_SUBCLASSES ARRAY_SIZE(dwg_list_subclasses) |
| #define SET_HDR_FLAGS | ( | name, | |
| bit, | |||
| inverse | |||
| ) |
| int _fields_size_sum | ( | const Dwg_DYNAPI_field *restrict | fields | ) |
| const Dwg_DYNAPI_field* dwg_dynapi_common_entity_field | ( | const char *restrict | fieldname | ) |
| const Dwg_DYNAPI_field* dwg_dynapi_common_entity_fields | ( | void | ) |
| const Dwg_DYNAPI_field* dwg_dynapi_common_object_field | ( | const char *restrict | fieldname | ) |
| const Dwg_DYNAPI_field* dwg_dynapi_common_object_fields | ( | void | ) |
| bool dwg_dynapi_common_set_value | ( | void *restrict | _obj, |
| const char *restrict | fieldname, | ||
| const void *restrict | value, | ||
| const bool | is_utf8 | ||
| ) |
Sets the common ENTITY or OBJECT.fieldname to a value. A malloc'ed struct is passed by ptr, not by the content. A non-malloc'ed struct is set by content. Arrays or strings must be malloced before. We just set the new pointer, the old value will be freed. If is_utf8 is set, the given value is a UTF-8 string, and will be converted to TV or TU.
| bool dwg_dynapi_common_utf8text | ( | void *restrict | _obj, |
| const char *restrict | fieldname, | ||
| char **restrict | out, | ||
| int * | isnew, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
| bool dwg_dynapi_common_value | ( | void *restrict | _obj, |
| const char *restrict | fieldname, | ||
| void *restrict | out, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
Returns the common ENTITY|OBJECT.fieldname value in out. _obj is the Dwg_Entity_ENTITY or Dwg_Object_OBJECT struct with the specific fields. The optional Dwg_DYNAPI_field *fp is filled with the field types from dynapi.c
| const Dwg_DYNAPI_field* dwg_dynapi_entity_field | ( | const char *restrict | name, |
| const char *restrict | field | ||
| ) |
| const Dwg_DYNAPI_field* dwg_dynapi_entity_fields | ( | const char * | name | ) |
| bool dwg_dynapi_entity_set_value | ( | void *restrict | entity, |
| const char *restrict | dxfname, | ||
| const char *restrict | fieldname, | ||
| const void *restrict | value, | ||
| const bool | is_utf8 | ||
| ) |
Sets the ENTITY.fieldname to a value. A malloc'ed struct is passed by ptr, not by the content. A non-malloc'ed struct is set by content. Arrays or strings must be malloced before. We just set the new pointer, the old value will be freed. If is_utf8 is set, the given value is a UTF-8 string, and will be converted to TV or TU.
| int dwg_dynapi_entity_size | ( | const char *restrict | name | ) |
| bool dwg_dynapi_entity_utf8text | ( | void *restrict | entity, |
| const char *restrict | name, | ||
| const char *restrict | fieldname, | ||
| char **restrict | textp, | ||
| int * | isnewp, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
Returns the ENTITY|OBJECT.fieldname text value in textp as utf-8. entity is the Dwg_Entity_ENTITY or Dwg_Object_OBJECT struct with the specific fields. The optional Dwg_DYNAPI_field *fp is filled with the field types from dynapi.c With DWG's since r2007+ creates a fresh UTF-8 conversion from the UTF-16 wchar value (which needs to be free'd), with older DWG's or with TV, TF or TFF returns the unconverted text value. Only valid for text fields. isnew is set to 1 if textp is freshly malloced (r2007+), otherwise 0
| bool dwg_dynapi_entity_value | ( | void *restrict | entity, |
| const char *restrict | dxfname, | ||
| const char *restrict | fieldname, | ||
| void *restrict | out, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
Returns the ENTITY|OBJECT.fieldname value in out. entity is the Dwg_Entity_ENTITY or Dwg_Object_OBJECT struct with the specific fields. The optional Dwg_DYNAPI_field *fp is filled with the field types from dynapi.c.
| const Dwg_DYNAPI_field* dwg_dynapi_field_dxf | ( | const Dwg_DYNAPI_field *restrict | fields, |
| const int | dxf, | ||
| int *restrict | unique | ||
| ) |
| bool dwg_dynapi_field_get_value | ( | const void *restrict | ptr, |
| const Dwg_DYNAPI_field *restrict | field, | ||
| void *restrict | out | ||
| ) |
| bool dwg_dynapi_field_set_value | ( | const Dwg_Data *restrict | dwg, |
| void *restrict | ptr, | ||
| const Dwg_DYNAPI_field *restrict | field, | ||
| const void *restrict | value, | ||
| const bool | is_utf8 | ||
| ) |
| int dwg_dynapi_fields_size | ( | const char *restrict | name | ) |
The sum of the size of all fields, by entity or subclass name
| char* dwg_dynapi_handle_name | ( | const Dwg_Data *restrict | dwg, |
| Dwg_Object_Ref *restrict | hdl, | ||
| int * | alloced | ||
| ) |
Checks if the handle hdl points an object or entity with a name field, and returns it if so. Converted to UTF8 for r2007+ wide-strings. Sets alloced if the returned string is freshly malloc'd.
| const Dwg_DYNAPI_field* dwg_dynapi_header_field | ( | const char *restrict | fieldname | ) |
Return the field for custom type checks.
| bool dwg_dynapi_header_set_value | ( | Dwg_Data *restrict | dwg, |
| const char *restrict | fieldname, | ||
| const void *restrict | value, | ||
| const bool | is_utf8 | ||
| ) |
Sets the HEADER.fieldname to a value. A malloc'ed struct or string is passed by ptr, not by the content. A non-malloc'ed struct is set by content. If is_utf8 is set, the given value is a UTF-8 string, and will be converted to TV or TU.
| bool dwg_dynapi_header_utf8text | ( | const Dwg_Data *restrict | dwg, |
| const char *restrict | fieldname, | ||
| char **restrict | out, | ||
| int * | isnew, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
| bool dwg_dynapi_header_value | ( | const Dwg_Data *restrict | dwg, |
| const char *restrict | fieldname, | ||
| void *restrict | out, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
Returns the HEADER.fieldname value in out. The optional Dwg_DYNAPI_field *fp is filled with the field types from dynapi.c
| bool dwg_dynapi_is_angle | ( | const char *restrict | name, |
| const char *restrict | fieldname | ||
| ) |
| bool dwg_dynapi_is_float | ( | const Dwg_DYNAPI_field * | f | ) |
| const Dwg_DYNAPI_field* dwg_dynapi_subclass_field | ( | const char *restrict | name, |
| const char *restrict | field | ||
| ) |
| const Dwg_DYNAPI_field* dwg_dynapi_subclass_fields | ( | const char *restrict | name | ) |
Find the fields for this subclass. See dwg.h
| char* dwg_dynapi_subclass_name | ( | const char *restrict | type | ) |
| bool dwg_dynapi_subclass_set_value | ( | Dwg_Data *restrict | dwg, |
| const void *restrict | ptr, | ||
| const char *restrict | subclass, | ||
| const char *restrict | fieldname, | ||
| const void *restrict | value, | ||
| const bool | is_utf8 | ||
| ) |
| int dwg_dynapi_subclass_size | ( | const char *restrict | name | ) |
| bool dwg_dynapi_subclass_value | ( | const void *restrict | ptr, |
| const char *restrict | subclass, | ||
| const char *restrict | fieldname, | ||
| void *restrict | out, | ||
| Dwg_DYNAPI_field *restrict | fp | ||
| ) |
Returns the common OBJECT.subclass.fieldname value in out. ptr points to the subclass field. The optional Dwg_DYNAPI_field *fp is filled with the field types from dynapi.c
| bool dwg_has_subclass | ( | const char *restrict | classname, |
| const char *restrict | subclass | ||
| ) |
| Dwg_Object* dwg_obj_generic_to_object | ( | const void *restrict | _vobj, |
| int *restrict | error | ||
| ) |
Returns dwg_object* from any dwg_obj_*
| [in] | _vobj | dwg_obj_generic* (layer, block_header, xrecord, ...) |
| [out] | error | int*, is set to 0 for ok, 1 on error |
| bool is_dwg_entity | ( | const char * | name | ) |
Check if the name is a valid ENTITY name, not an OBJECT.
| bool is_dwg_object | ( | const char * | name | ) |
Check if the name is a valid OBJECT name, not an ENTITY.