Skip to content

Commit ee5f5f6

Browse files
committed
Add and apply astyle rules for pdal
See https://pdal.io/project/conventions.html#source-formatting
1 parent 5edb1e0 commit ee5f5f6

20 files changed

+2217
-2192
lines changed

astylerc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# usage (for a single file):
2+
# AStyle.exe --options=astylerc source/pdal/pdalc_config.cpp
3+
# usage (for directories):
4+
# AStyle.exe --options=astylerc --recursive "source/pdal/*.h" "source/pdal/*.cpp" "tests/pdal/*.c" "tests/pdal/*.c.in"
5+
6+
--style=ansi
7+
8+
--indent=spaces=4
9+
10+
--convert-tabs
11+
12+
--lineend=linux
13+
14+
--suffix=none
15+
16+
--unpad-paren
17+
18+
--indent-switches
19+
20+
--indent-cases
21+
22+
--indent-labels
23+
24+
--pad-header

source/pdal/pdalc_config.cpp

Lines changed: 183 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -38,188 +38,188 @@
3838

3939
namespace pdal
4040
{
41-
namespace capi
42-
{
43-
size_t PDALGetGdalDataPath(char *path, size_t size)
44-
{
45-
size_t length = 0;
46-
47-
if (path && size > 0)
48-
{
49-
path[0] = '\0';
50-
path[size-1] = '\0';
51-
52-
char *env = nullptr;
53-
54-
try
55-
{
56-
env = std::getenv("GDAL_DATA");
57-
}
58-
catch (const std::exception &)
59-
{
60-
env = nullptr;
61-
}
62-
63-
if (env)
64-
{
65-
std::strncpy(path, env, size - 1);
66-
length = std::min(std::strlen(env), size - 1);
67-
}
68-
}
69-
70-
return length;
71-
}
72-
73-
size_t PDALGetProj4DataPath(char *path, size_t size)
74-
{
75-
size_t length = 0;
76-
77-
if (path && size > 0)
78-
{
79-
path[0] = '\0';
80-
path[size-1] = '\0';
81-
82-
char *env = nullptr;
83-
84-
try
85-
{
86-
env = std::getenv("PROJ_LIB");
87-
}
88-
catch (const std::exception &)
89-
{
90-
env = nullptr;
91-
}
92-
93-
if (env)
94-
{
95-
std::strncpy(path, env, size - 1);
96-
length = std::min(std::strlen(env), size - 1);
97-
}
98-
}
99-
100-
return length;
101-
}
102-
103-
void PDALSetGdalDataPath(const char *path)
104-
{
105-
if (path)
106-
{
107-
pdal::Utils::setenv("GDAL_DATA", path);
108-
}
109-
}
110-
111-
void PDALSetProj4DataPath(const char *path)
112-
{
113-
if (path)
114-
{
115-
pdal::Utils::setenv("PROJ_LIB", path);
116-
}
117-
}
118-
119-
size_t PDALFullVersionString(char *version, size_t size)
120-
{
121-
size_t length = 0;
122-
123-
if (version && size > 0)
124-
{
125-
version[0] = '\0';
126-
version[size-1] = '\0';
127-
128-
std::string s = pdal::Config::fullVersionString();
129-
std::strncpy(version, s.c_str(), size - 1);
130-
length = std::min(s.length(), size - 1);
131-
}
132-
133-
return length;
134-
}
135-
136-
size_t PDALVersionString(char *version, size_t size)
137-
{
138-
size_t length = 0;
139-
140-
if (version && size > 0)
141-
{
142-
version[0] = '\0';
143-
version[size-1] = '\0';
144-
145-
std::string s = pdal::Config::versionString();
146-
std::strncpy(version, s.c_str(), size - 1);
147-
length = std::min(s.length(), size - 1);
148-
}
149-
150-
return length;
151-
}
152-
153-
int PDALVersionInteger()
154-
{
155-
return pdal::Config::versionInteger();
156-
}
157-
158-
size_t PDALSha1(char *sha1, size_t size)
159-
{
160-
size_t length = 0;
161-
162-
if (sha1 && size > 0)
163-
{
164-
sha1[0] = '\0';
165-
sha1[size-1] = '\0';
166-
167-
std::string s = pdal::Config::sha1();
168-
std::strncpy(sha1, s.c_str(), size - 1);
169-
length = std::min(s.length(), size - 1);
170-
}
171-
172-
return length;
173-
}
174-
175-
int PDALVersionMajor()
176-
{
177-
return pdal::Config::versionMajor();
178-
}
179-
180-
int PDALVersionMinor()
181-
{
182-
return pdal::Config::versionMinor();
183-
}
184-
185-
int PDALVersionPatch()
186-
{
187-
return pdal::Config::versionPatch();
188-
}
189-
190-
size_t PDALDebugInformation(char *info, size_t size)
191-
{
192-
size_t length = 0;
193-
194-
if (info && size > 0)
195-
{
196-
info[0] = '\0';
197-
info[size-1] = '\0';
198-
199-
std::string s = pdal::Config::debugInformation();
200-
std::strncpy(info, s.c_str(), size - 1);
201-
length = std::min(s.length(), size - 1);
202-
}
203-
204-
return length;
205-
}
206-
207-
size_t PDALPluginInstallPath(char *path, size_t size)
208-
{
209-
size_t length = 0;
210-
211-
if (path && size > 0)
212-
{
213-
path[0] = '\0';
214-
path[size-1] = '\0';
215-
216-
std::string s = pdal::Config::pluginInstallPath();
217-
std::strncpy(path, s.c_str(), size - 1);
218-
length = std::min(s.length(), size - 1);
219-
}
220-
221-
return length;
222-
}
223-
}
41+
namespace capi
42+
{
43+
size_t PDALGetGdalDataPath(char *path, size_t size)
44+
{
45+
size_t length = 0;
46+
47+
if (path && size > 0)
48+
{
49+
path[0] = '\0';
50+
path[size-1] = '\0';
51+
52+
char *env = nullptr;
53+
54+
try
55+
{
56+
env = std::getenv("GDAL_DATA");
57+
}
58+
catch (const std::exception &)
59+
{
60+
env = nullptr;
61+
}
62+
63+
if (env)
64+
{
65+
std::strncpy(path, env, size - 1);
66+
length = std::min(std::strlen(env), size - 1);
67+
}
68+
}
69+
70+
return length;
71+
}
72+
73+
size_t PDALGetProj4DataPath(char *path, size_t size)
74+
{
75+
size_t length = 0;
76+
77+
if (path && size > 0)
78+
{
79+
path[0] = '\0';
80+
path[size-1] = '\0';
81+
82+
char *env = nullptr;
83+
84+
try
85+
{
86+
env = std::getenv("PROJ_LIB");
87+
}
88+
catch (const std::exception &)
89+
{
90+
env = nullptr;
91+
}
92+
93+
if (env)
94+
{
95+
std::strncpy(path, env, size - 1);
96+
length = std::min(std::strlen(env), size - 1);
97+
}
98+
}
99+
100+
return length;
101+
}
102+
103+
void PDALSetGdalDataPath(const char *path)
104+
{
105+
if (path)
106+
{
107+
pdal::Utils::setenv("GDAL_DATA", path);
108+
}
109+
}
110+
111+
void PDALSetProj4DataPath(const char *path)
112+
{
113+
if (path)
114+
{
115+
pdal::Utils::setenv("PROJ_LIB", path);
116+
}
117+
}
118+
119+
size_t PDALFullVersionString(char *version, size_t size)
120+
{
121+
size_t length = 0;
122+
123+
if (version && size > 0)
124+
{
125+
version[0] = '\0';
126+
version[size-1] = '\0';
127+
128+
std::string s = pdal::Config::fullVersionString();
129+
std::strncpy(version, s.c_str(), size - 1);
130+
length = std::min(s.length(), size - 1);
131+
}
132+
133+
return length;
134+
}
135+
136+
size_t PDALVersionString(char *version, size_t size)
137+
{
138+
size_t length = 0;
139+
140+
if (version && size > 0)
141+
{
142+
version[0] = '\0';
143+
version[size-1] = '\0';
144+
145+
std::string s = pdal::Config::versionString();
146+
std::strncpy(version, s.c_str(), size - 1);
147+
length = std::min(s.length(), size - 1);
148+
}
149+
150+
return length;
151+
}
152+
153+
int PDALVersionInteger()
154+
{
155+
return pdal::Config::versionInteger();
156+
}
157+
158+
size_t PDALSha1(char *sha1, size_t size)
159+
{
160+
size_t length = 0;
161+
162+
if (sha1 && size > 0)
163+
{
164+
sha1[0] = '\0';
165+
sha1[size-1] = '\0';
166+
167+
std::string s = pdal::Config::sha1();
168+
std::strncpy(sha1, s.c_str(), size - 1);
169+
length = std::min(s.length(), size - 1);
170+
}
171+
172+
return length;
173+
}
174+
175+
int PDALVersionMajor()
176+
{
177+
return pdal::Config::versionMajor();
178+
}
179+
180+
int PDALVersionMinor()
181+
{
182+
return pdal::Config::versionMinor();
183+
}
184+
185+
int PDALVersionPatch()
186+
{
187+
return pdal::Config::versionPatch();
188+
}
189+
190+
size_t PDALDebugInformation(char *info, size_t size)
191+
{
192+
size_t length = 0;
193+
194+
if (info && size > 0)
195+
{
196+
info[0] = '\0';
197+
info[size-1] = '\0';
198+
199+
std::string s = pdal::Config::debugInformation();
200+
std::strncpy(info, s.c_str(), size - 1);
201+
length = std::min(s.length(), size - 1);
202+
}
203+
204+
return length;
205+
}
206+
207+
size_t PDALPluginInstallPath(char *path, size_t size)
208+
{
209+
size_t length = 0;
210+
211+
if (path && size > 0)
212+
{
213+
path[0] = '\0';
214+
path[size-1] = '\0';
215+
216+
std::string s = pdal::Config::pluginInstallPath();
217+
std::strncpy(path, s.c_str(), size - 1);
218+
length = std::min(s.length(), size - 1);
219+
}
220+
221+
return length;
222+
}
223+
}
224224
}
225225

0 commit comments

Comments
 (0)