Skip to content

Commit cec7117

Browse files
committed
Added missing files
1 parent 6ced646 commit cec7117

4 files changed

Lines changed: 683 additions & 0 deletions

File tree

src/ifcparse/IfcGuidHelper.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/********************************************************************************
2+
* *
3+
* This file is part of IfcOpenShell. *
4+
* *
5+
* IfcOpenShell is free software: you can redistribute it and/or modify *
6+
* it under the terms of the Lesser GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3.0 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* IfcOpenShell is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* Lesser GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the Lesser GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
********************************************************************************/
19+
20+
/********************************************************************************
21+
* *
22+
* Please consider this a placeholder for an actual GlobalId generation *
23+
* algorithm. A real implementation could for example be based on Boost::uuid *
24+
* *
25+
********************************************************************************/
26+
27+
#include <time.h>
28+
29+
#include "IfcWrite.h"
30+
31+
static const char* chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$";
32+
33+
IfcWrite::IfcGuidHelper::IfcGuidHelper() {
34+
if ( ! seeded ) { srand((unsigned int)time(0)); seeded = true; }
35+
data.resize(length);
36+
for ( unsigned int i = 0; i < length; ++ i ) {
37+
data[i] = chars[rand()%length];
38+
}
39+
}
40+
IfcWrite::IfcGuidHelper::operator std::string() const {
41+
return data;
42+
}
43+
44+
bool IfcWrite::IfcGuidHelper::seeded = false;

src/ifcparse/IfcWritableEntity.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/********************************************************************************
2+
* *
3+
* This file is part of IfcOpenShell. *
4+
* *
5+
* IfcOpenShell is free software: you can redistribute it and/or modify *
6+
* it under the terms of the Lesser GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3.0 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* IfcOpenShell is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* Lesser GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the Lesser GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
********************************************************************************/
19+
20+
/********************************************************************************
21+
* *
22+
* This namespace provides implementations of Argument and Entity that use STL *
23+
* containers for their datatypes and are not just lazy references to the *
24+
* IFC-SPF file. Therefore they can be modified by the client application. *
25+
* *
26+
* An IfcWritableEntity can be constructed from a regular IfcParse entity to be *
27+
* able to modify the data in existing IFC files. *
28+
* *
29+
********************************************************************************/
30+
31+
#ifndef IFCWRITABLEENTITY_H
32+
#define IFCWRITABLEENTITY_H
33+
34+
#include "IfcUtil.h"
35+
36+
namespace IfcWrite {
37+
class IfcWritableEntity : public IfcAbstractEntity {
38+
private:
39+
std::map<int,bool> writemask;
40+
std::map<int,ArgumentPtr> args;
41+
Ifc2x3::Type::Enum _type;
42+
int* _id;
43+
bool arg_writable(int i);
44+
void arg_writable(int i, bool b);
45+
public:
46+
IfcWritableEntity(Ifc2x3::Type::Enum t);
47+
int setId(int i=-1);
48+
IfcWritableEntity(IfcAbstractEntity* e);
49+
IfcEntities getInverse(Ifc2x3::Type::Enum c = Ifc2x3::Type::ALL);
50+
IfcEntities getInverse(Ifc2x3::Type::Enum c, int i, const std::string& a);
51+
std::string datatype();
52+
ArgumentPtr getArgument (unsigned int i);
53+
unsigned int getArgumentCount();
54+
Ifc2x3::Type::Enum type() const;
55+
bool is(Ifc2x3::Type::Enum v) const;
56+
std::string toString(bool upper=false);
57+
unsigned int id();
58+
bool isWritable();
59+
void setArgument(int i,int v);
60+
void setArgument(int i,int v, const char* c);
61+
void setArgument(int i,const Nullable<std::string>& v);
62+
void setArgument(int i,const std::string& v);
63+
void setArgument(int i,double v);
64+
void setArgument(int i,IfcUtil::IfcSchemaEntity v);
65+
void setArgument(int i,IfcEntities v);
66+
void setArgument(int i,const std::vector<double>& v);
67+
void setArgument(int i,const std::vector<std::string>& v);
68+
void setArgument(int i,const std::vector<int>& v);
69+
};
70+
71+
}
72+
73+
#endif

0 commit comments

Comments
 (0)