forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschRename.h
More file actions
51 lines (44 loc) · 1.59 KB
/
schRename.h
File metadata and controls
51 lines (44 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SCHRENAME_H
#define SCHRENAME_H
#include <cstdio>
#include <cstring>
#include "clutils/Str.h"
#include "sc_export.h"
/** \class SchRename
* SchRename is a structure which partially support the concept of USE and RE-
* FERENCE in EXPRESS. Say schema A USEs object X from schema B and renames it
* to Y (i.e., "USE (X as Y);"). SchRename stores the name of the schema (B)
* plus the new object name for that schema (Y). Each TypeDescriptor has a
* SchRename object (actually a linked list of SchRenames) corresponding to all
* the possible different names of itself depending on the current schema (the
* schema which is currently reading or writing this object). (The current
* schema is determined by the file schema section of the header section of a
* part21 file (the _headerInstances of STEPfile).
*/
class SC_CORE_EXPORT SchRename {
public:
SchRename( const char * sch = "\0", const char * newnm = "\0" ) : next( 0 ) {
strncpy( schName, sch, BUFSIZ );
schName[BUFSIZ] = '\0';
strncpy( newName, newnm, BUFSIZ );
newName[BUFSIZ] = '\0';
}
~SchRename() {
delete next;
}
const char * objName() const {
return newName;
}
int operator< ( SchRename & schrnm ) {
return ( strcmp( schName, schrnm.schName ) < 0 );
}
bool choice( const char * nm ) const;
// is nm one of our possible choices?
char * rename( const char * schm, char * newnm ) const;
// given a schema name, returns new object name if exists
SchRename * next;
private:
char schName[BUFSIZ+1];
char newName[BUFSIZ+1];
};
#endif //SCHRENAME_H