libDXF 0.0.1
A library with DXF related functions written in C.
|
Functions for a DXF comment entity (COMMENT
).
More...
#include "comment.h"
Go to the source code of this file.
Functions | |
DxfComment * | dxf_comment_new () |
Allocate memory for a DXF COMMENT . | |
DxfComment * | dxf_comment_init (DxfComment *comment) |
Allocate memory and initialize data fields in a DXF COMMENT entity. | |
int | dxf_comment_write (DxfFile *fp, DxfComment *comment) |
Write DXF output to fp for a comment. | |
int | dxf_comment_free (DxfComment *comment) |
Free the allocated memory for a DXF COMMENT and all it's data fields. | |
void | dxf_comment_free_chain (DxfComment *comments) |
Free the allocated memory for a chain of DXF COMMENT entities and all their data fields. | |
int | dxf_comment_get_id_code (DxfComment *comment) |
Get the ID code from a DXF COMMENT entity. | |
DxfComment * | dxf_comment_set_id_code (DxfComment *comment, int id_code) |
Set the ID code for a DXF COMMENT entity. | |
char * | dxf_comment_get_value (DxfComment *comment) |
Get the value string from a DXF COMMENT entity. | |
DxfComment * | dxf_comment_set_value (DxfComment *comment, char *value) |
Set the given string for a DXF COMMENT entity. | |
DxfComment * | dxf_comment_get_next (DxfComment *comment) |
Get the pointer to the next COMMENT entity from a DXF COMMENT entity. | |
DxfComment * | dxf_comment_set_next (DxfComment *comment, DxfComment *next) |
Set the pointer to the next COMMENT for a DXF COMMENT entity. | |
DxfComment * | dxf_comment_get_last (DxfComment *comment) |
Get the pointer to the last COMMENT entity from a linked list of DXF COMMENT entities. |
Functions for a DXF comment entity (COMMENT
).
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330,
Boston,
MA 02111 USA.
Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.
Definition in file comment.c.
DxfComment* dxf_comment_new | ( | ) |
Allocate memory for a DXF COMMENT
.
Fill the memory contents with zeros.
Definition at line 51 of file comment.c.
References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.
Referenced by dxf_comment_init().
DxfComment* dxf_comment_init | ( | DxfComment * | comment | ) |
Allocate memory and initialize data fields in a DXF COMMENT
entity.
NULL
when no memory was allocated, a pointer to the allocated memory when succesful. comment | a pointer to the DXF COMMENT entity. |
Definition at line 89 of file comment.c.
References _, dxf_comment_new(), dxf_comment_set_id_code(), dxf_comment_set_next(), dxf_comment_set_value(), DXF_DEBUG_BEGIN, and DXF_DEBUG_END.
int dxf_comment_write | ( | DxfFile * | fp, |
DxfComment * | comment | ||
) |
Write DXF output to fp for a comment.
The 999 group code indicates that the following line is a comment string.
DXFOUT does not currently include such groups in a DXF output file, but DXFIN honors them and ignores the comments.
Thus, you can use the 999 group to include comments in a DXF file you've edited.
Multi-line comments are implemented as a single linked list of DxfComment structs.
A pointer to the next comment is stored in the next
member of the DXF COMMENT
struct.
This function writes comments to the file descriptor until a NULL
pointer is encountered.
fp | file pointer to output file (or device). |
comment | a pointer to the DXF COMMENT entity. |
Definition at line 140 of file comment.c.
References _, dxf_comment_get_next(), dxf_comment_get_value(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_file_struct::fp.
int dxf_comment_free | ( | DxfComment * | comment | ) |
Free the allocated memory for a DXF COMMENT
and all it's data fields.
EXIT_SUCCESS
when done, or EXIT_FAILURE
when an error occurred. comment | a pointer to the memory occupied by the DXF COMMENT entity. |
Definition at line 181 of file comment.c.
References _, dxf_comment_get_value(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.
Referenced by dxf_comment_free_chain().
void dxf_comment_free_chain | ( | DxfComment * | comments | ) |
Free the allocated memory for a chain of DXF COMMENT
entities and all their data fields.
comments | a pointer to the chain of DXF COMMENT entities. |
Definition at line 220 of file comment.c.
References _, dxf_comment_free(), DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.
int dxf_comment_get_id_code | ( | DxfComment * | comment | ) |
Get the ID code from a DXF COMMENT
entity.
comment | a pointer to a DXF COMMENT entity. |
Definition at line 253 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::id_code.
DxfComment* dxf_comment_set_id_code | ( | DxfComment * | comment, |
int | id_code | ||
) |
Set the ID code for a DXF COMMENT
entity.
comment | a pointer to a DXF COMMENT entity. |
id_code | Identification number for the entity. This is to be an unique (sequential) number in the DXF file. |
Definition at line 288 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::id_code.
Referenced by dxf_comment_init().
char* dxf_comment_get_value | ( | DxfComment * | comment | ) |
Get the value string from a DXF COMMENT
entity.
comment | a pointer to the chain of DXF COMMENT entities. |
Definition at line 328 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::value.
Referenced by dxf_comment_free(), and dxf_comment_write().
DxfComment* dxf_comment_set_value | ( | DxfComment * | comment, |
char * | value | ||
) |
Set the given string for a DXF COMMENT
entity.
comment | a pointer to the chain of DXF COMMENT entities. |
value | the comment value (string) to be set. |
Definition at line 362 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::value.
Referenced by dxf_comment_init().
DxfComment* dxf_comment_get_next | ( | DxfComment * | comment | ) |
Get the pointer to the next COMMENT
entity from a DXF COMMENT
entity.
COMMENT
entity.comment | a pointer to a DXF COMMENT entity. |
Definition at line 404 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.
Referenced by dxf_comment_write().
DxfComment* dxf_comment_set_next | ( | DxfComment * | comment, |
DxfComment * | next | ||
) |
Set the pointer to the next COMMENT
for a DXF COMMENT
entity.
comment | a pointer to a DXF COMMENT entity. |
next | a pointer to the next COMMENT for the entity. |
Definition at line 440 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.
Referenced by dxf_comment_init().
DxfComment* dxf_comment_get_last | ( | DxfComment * | comment | ) |
Get the pointer to the last COMMENT
entity from a linked list of DXF COMMENT
entities.
COMMENT
entity.comment | a pointer to a DXF COMMENT entity. |
Definition at line 483 of file comment.c.
References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_comment_struct::next.