Skip to content

Commit 611cadc

Browse files
committed
Normalize celestia:: namespace aliases
Simplification for future migration to the celestia namespace
1 parent 22fb030 commit 611cadc

File tree

12 files changed

+140
-143
lines changed

12 files changed

+140
-143
lines changed

src/cel3ds/3dsread.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <celutil/logger.h>
2727
#include "3dsmodel.h"
2828

29-
namespace celutil = celestia::util;
30-
using celestia::util::GetLogger;
29+
namespace util = celestia::util;
30+
using util::GetLogger;
3131

3232
namespace
3333
{
@@ -105,7 +105,7 @@ namespace
105105
bool readChunkType(std::istream& in, M3DChunkType& chunkType)
106106
{
107107
std::uint16_t value;
108-
if (!celutil::readLE<std::uint16_t>(in, value)) { return false; }
108+
if (!util::readLE<std::uint16_t>(in, value)) { return false; }
109109
chunkType = static_cast<M3DChunkType>(value);
110110
return true;
111111
}
@@ -185,7 +185,7 @@ bool readChunks(std::istream& in, std::int32_t contentSize, T& obj, ProcessFunc
185185
GetLogger()->debug("Found chunk type {}\n", chunkType);
186186

187187
std::int32_t chunkSize;
188-
if (!celutil::readLE<std::int32_t>(in, chunkSize))
188+
if (!util::readLE<std::int32_t>(in, chunkSize))
189189
{
190190
GetLogger()->error("Failed to read chunk size\n", chunkType);
191191
return false;
@@ -224,7 +224,7 @@ bool readPointArray(std::istream& in, std::int32_t contentSize, M3DTriangleMesh&
224224
}
225225

226226
std::uint16_t nPoints;
227-
if (!celutil::readLE<std::uint16_t>(in, nPoints))
227+
if (!util::readLE<std::uint16_t>(in, nPoints))
228228
{
229229
GetLogger()->error("Failed to read point array count\n");
230230
return false;
@@ -241,9 +241,9 @@ bool readPointArray(std::istream& in, std::int32_t contentSize, M3DTriangleMesh&
241241
for (std::int32_t i = 0; i < pointsCount; ++i)
242242
{
243243
Eigen::Vector3f vertex;
244-
if (!celutil::readLE<float>(in, vertex.x())
245-
|| !celutil::readLE<float>(in, vertex.y())
246-
|| !celutil::readLE<float>(in, vertex.z()))
244+
if (!util::readLE<float>(in, vertex.x())
245+
|| !util::readLE<float>(in, vertex.y())
246+
|| !util::readLE<float>(in, vertex.z()))
247247
{
248248
GetLogger()->error("Failed to read entry {} of point array\n", i);
249249
return false;
@@ -266,7 +266,7 @@ bool readTextureCoordArray(std::istream& in, std::int32_t contentSize, M3DTriang
266266
}
267267

268268
std::uint16_t nTexCoords;
269-
if (!celutil::readLE<std::uint16_t>(in, nTexCoords))
269+
if (!util::readLE<std::uint16_t>(in, nTexCoords))
270270
{
271271
GetLogger()->error("Failed to read texture coord array count\n");
272272
return false;
@@ -283,8 +283,8 @@ bool readTextureCoordArray(std::istream& in, std::int32_t contentSize, M3DTriang
283283
for (std::int32_t i = 0; i < texCoordsCount; ++i)
284284
{
285285
Eigen::Vector2f texCoord;
286-
if (!celutil::readLE<float>(in, texCoord.x())
287-
|| !celutil::readLE<float>(in, texCoord.y()))
286+
if (!util::readLE<float>(in, texCoord.x())
287+
|| !util::readLE<float>(in, texCoord.y()))
288288
{
289289
GetLogger()->error("Failed to read entry {} of texture coord array\n", i);
290290
return false;
@@ -310,7 +310,7 @@ bool readMeshMaterialGroup(std::istream& in, std::int32_t contentSize, M3DTriang
310310
}
311311

312312
std::uint16_t nFaces;
313-
if (!celutil::readLE<std::uint16_t>(in, nFaces))
313+
if (!util::readLE<std::uint16_t>(in, nFaces))
314314
{
315315
GetLogger()->error("Failed to read material group face array count\n");
316316
return false;
@@ -327,7 +327,7 @@ bool readMeshMaterialGroup(std::istream& in, std::int32_t contentSize, M3DTriang
327327
for (std::int32_t i = 0; i < faceCount; ++i)
328328
{
329329
std::uint16_t faceIndex;
330-
if (!celutil::readLE(in, faceIndex))
330+
if (!util::readLE(in, faceIndex))
331331
{
332332
GetLogger()->error("Failed to read entry {} of material group face array\n", i);
333333
return false;
@@ -354,7 +354,7 @@ bool readMeshSmoothGroup(std::istream& in, std::int32_t contentSize, M3DTriangle
354354
for (std::int32_t i = 0; i < faceCount; ++i)
355355
{
356356
std::uint32_t groups;
357-
if (!celutil::readLE<std::uint32_t>(in, groups))
357+
if (!util::readLE<std::uint32_t>(in, groups))
358358
{
359359
GetLogger()->error("Failed to read entry {} of smoothing group array\n", i);
360360
return false;
@@ -395,7 +395,7 @@ bool readFaceArray(std::istream& in, std::int32_t contentSize, M3DTriangleMesh&
395395
}
396396

397397
std::uint16_t nFaces;
398-
if (!celutil::readLE<std::uint16_t>(in, nFaces))
398+
if (!util::readLE<std::uint16_t>(in, nFaces))
399399
{
400400
GetLogger()->error("Failed to read face array count\n");
401401
return false;
@@ -412,10 +412,10 @@ bool readFaceArray(std::istream& in, std::int32_t contentSize, M3DTriangleMesh&
412412
for (std::int32_t i = 0; i < faceCount; ++i)
413413
{
414414
std::uint16_t v0, v1, v2, flags;
415-
if (!celutil::readLE<std::uint16_t>(in, v0)
416-
|| !celutil::readLE<std::uint16_t>(in, v1)
417-
|| !celutil::readLE<std::uint16_t>(in, v2)
418-
|| !celutil::readLE<std::uint16_t>(in, flags))
415+
if (!util::readLE<std::uint16_t>(in, v0)
416+
|| !util::readLE<std::uint16_t>(in, v1)
417+
|| !util::readLE<std::uint16_t>(in, v2)
418+
|| !util::readLE<std::uint16_t>(in, flags))
419419
{
420420
GetLogger()->error("Failed to read entry {} of face array\n", i);
421421
return false;
@@ -445,7 +445,7 @@ bool readMeshMatrix(std::istream& in, std::int32_t contentSize, M3DTriangleMesh&
445445
float elements[12];
446446
for (std::size_t i = 0; i < 12; ++i)
447447
{
448-
if (!celutil::readLE<float>(in, elements[i]))
448+
if (!util::readLE<float>(in, elements[i]))
449449
{
450450
GetLogger()->error("Failed to read element {} of mesh matrix\n", i);
451451
return false;
@@ -537,9 +537,9 @@ bool readColorFloat(std::istream& in, std::int32_t contentSize, M3DColor& color)
537537
return skipTrailing(in, contentSize);
538538
}
539539

540-
if (!celutil::readLE<float>(in, color.red)
541-
|| !celutil::readLE<float>(in, color.green)
542-
|| !celutil::readLE<float>(in, color.blue))
540+
if (!util::readLE<float>(in, color.red)
541+
|| !util::readLE<float>(in, color.green)
542+
|| !util::readLE<float>(in, color.blue))
543543
{
544544
GetLogger()->error("Error reading ColorFloat RGB values");
545545
return false;
@@ -578,7 +578,7 @@ bool readIntPercentage(std::istream& in, std::int32_t contentSize, float& percen
578578
}
579579

580580
std::int16_t value;
581-
if (!celutil::readLE<std::int16_t>(in, value))
581+
if (!util::readLE<std::int16_t>(in, value))
582582
{
583583
GetLogger()->error("Error reading IntPercentage\n");
584584
return false;
@@ -598,7 +598,7 @@ bool readFloatPercentage(std::istream& in, std::int32_t contentSize, float& perc
598598
return skipTrailing(in, contentSize);
599599
}
600600

601-
if (!celutil::readLE<float>(in, percentage))
601+
if (!util::readLE<float>(in, percentage))
602602
{
603603
GetLogger()->error("Error reading FloatPercentage\n");
604604
return false;
@@ -786,7 +786,7 @@ std::unique_ptr<M3DScene> Read3DSFile(std::istream& in)
786786
}
787787

788788
std::int32_t chunkSize;
789-
if (!celutil::readLE<std::int32_t>(in, chunkSize) || chunkSize < chunkHeaderSize)
789+
if (!util::readLE<std::int32_t>(in, chunkSize) || chunkSize < chunkHeaderSize)
790790
{
791791
GetLogger()->error("Read3DSFile: Error reading 3DS file top level chunk size\n");
792792
return nullptr;

src/celengine/hash.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "value.h"
1717

1818
namespace astro = celestia::astro;
19-
namespace celutil = celestia::util;
19+
namespace util = celestia::util;
2020

2121
// Define these here: at declaration the vector member contains an incomplete type
2222
AssociativeArray::~AssociativeArray() = default;
@@ -63,7 +63,7 @@ std::optional<fs::path> AssociativeArray::getPath(std::string_view key) const
6363
const std::string* v = getString(key);
6464
if (v == nullptr) { return std::nullopt; }
6565

66-
return std::make_optional(celutil::PathExp(*v));
66+
return std::make_optional(util::PathExp(*v));
6767
}
6868

6969

src/celengine/parseobject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using celestia::ephem::TrajectoryPrecision;
4040
using celestia::util::GetLogger;
4141

4242
namespace astro = celestia::astro;
43-
namespace celephem = celestia::ephem;
43+
namespace ephem = celestia::ephem;
4444

4545
/**
4646
* Returns the default units scale for orbits.
@@ -696,7 +696,7 @@ CreateOrbit(const Selection& centralObject,
696696
{
697697
if (const std::string* customOrbitName = planetData->getString("CustomOrbit"); customOrbitName != nullptr)
698698
{
699-
if (auto orbit = celephem::GetCustomOrbit(*customOrbitName); orbit != nullptr)
699+
if (auto orbit = ephem::GetCustomOrbit(*customOrbitName); orbit != nullptr)
700700
return orbit.release();
701701
GetLogger()->error("Could not find custom orbit named '{}'\n", *customOrbitName);
702702
}

src/celengine/simulation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "render.h"
2222

2323

24-
namespace celutil = celestia::util;
25-
2624
Simulation::Simulation(Universe* _universe) :
2725
universe(_universe)
2826
{

src/celengine/stardb.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ using celestia::util::GetLogger;
4141
using celestia::util::IntrusivePtr;
4242

4343
namespace astro = celestia::astro;
44-
namespace celutil = celestia::util;
4544

4645
// Enable the below to switch back to parsing coordinates as float to match
4746
// legacy behaviour. This shouldn't be necessary since stars.dat stores

src/celengine/universe.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "render.h"
3434
#include "timelinephase.h"
3535

36-
namespace celutil = celestia::util;
36+
namespace util = celestia::util;
3737

3838
namespace
3939
{
@@ -1085,7 +1085,7 @@ Universe::findObjectInContext(const Selection& sel,
10851085
// to us to search.
10861086
Selection
10871087
Universe::find(std::string_view s,
1088-
celutil::array_view<const Selection> contexts,
1088+
util::array_view<const Selection> contexts,
10891089
bool i18n) const
10901090
{
10911091
if (starCatalog != nullptr)
@@ -1127,7 +1127,7 @@ Universe::find(std::string_view s,
11271127
// in which the user is currently located.
11281128
Selection
11291129
Universe::findPath(std::string_view s,
1130-
celutil::array_view<const Selection> contexts,
1130+
util::array_view<const Selection> contexts,
11311131
bool i18n) const
11321132
{
11331133
std::string_view::size_type pos = s.find('/', 0);
@@ -1161,7 +1161,7 @@ Universe::findPath(std::string_view s,
11611161
void
11621162
Universe::getCompletion(std::vector<std::string>& completion,
11631163
std::string_view s,
1164-
celutil::array_view<const Selection> contexts,
1164+
util::array_view<const Selection> contexts,
11651165
bool withLocations) const
11661166
{
11671167
// Solar bodies first:
@@ -1194,7 +1194,7 @@ Universe::getCompletion(std::vector<std::string>& completion,
11941194
void
11951195
Universe::getCompletionPath(std::vector<std::string>& completion,
11961196
std::string_view s,
1197-
celutil::array_view<const Selection> contexts,
1197+
util::array_view<const Selection> contexts,
11981198
bool withLocations) const
11991199
{
12001200
std::string_view::size_type pos = s.rfind('/', s.length());

src/celimage/bmp.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <celutil/logger.h>
1919
#include "image.h"
2020

21-
namespace celutil = celestia::util;
22-
using celestia::util::GetLogger;
21+
namespace util = celestia::util;
22+
using util::GetLogger;
2323

2424
namespace
2525
{
@@ -54,30 +54,30 @@ Image* LoadBMPImage(std::istream& in)
5454
BMPFileHeader fileHeader;
5555
BMPImageHeader imageHeader;
5656

57-
if (!celutil::readLE<unsigned char>(in, fileHeader.magic[0])
57+
if (!util::readLE<unsigned char>(in, fileHeader.magic[0])
5858
|| fileHeader.magic[0] != 'B'
59-
|| !celutil::readLE<unsigned char>(in, fileHeader.magic[1])
59+
|| !util::readLE<unsigned char>(in, fileHeader.magic[1])
6060
|| fileHeader.magic[1] != 'M'
61-
|| !celutil::readLE<std::uint32_t>(in, fileHeader.size)
62-
|| !celutil::readLE<std::uint32_t>(in, fileHeader.reserved)
63-
|| !celutil::readLE<std::uint32_t>(in, fileHeader.offset)
64-
|| !celutil::readLE<std::uint32_t>(in, imageHeader.size)
65-
|| !celutil::readLE<std::int32_t>(in, imageHeader.width)
61+
|| !util::readLE<std::uint32_t>(in, fileHeader.size)
62+
|| !util::readLE<std::uint32_t>(in, fileHeader.reserved)
63+
|| !util::readLE<std::uint32_t>(in, fileHeader.offset)
64+
|| !util::readLE<std::uint32_t>(in, imageHeader.size)
65+
|| !util::readLE<std::int32_t>(in, imageHeader.width)
6666
|| imageHeader.width <= 0
67-
|| !celutil::readLE<std::int32_t>(in, imageHeader.height)
67+
|| !util::readLE<std::int32_t>(in, imageHeader.height)
6868
|| imageHeader.height <= 0
69-
|| !celutil::readLE<std::uint16_t>(in, imageHeader.planes)
70-
|| !celutil::readLE<std::uint16_t>(in, imageHeader.bpp)
69+
|| !util::readLE<std::uint16_t>(in, imageHeader.planes)
70+
|| !util::readLE<std::uint16_t>(in, imageHeader.bpp)
7171
// We don't handle 1-, 2-, or 4-bpp images
7272
|| (imageHeader.bpp != 8 && imageHeader.bpp != 24 && imageHeader.bpp != 32)
73-
|| !celutil::readLE<std::uint32_t>(in, imageHeader.compression)
73+
|| !util::readLE<std::uint32_t>(in, imageHeader.compression)
7474
// We currently don't support compressed BMPs
7575
|| imageHeader.compression != 0
76-
|| !celutil::readLE<std::uint32_t>(in, imageHeader.imageSize)
77-
|| !celutil::readLE<std::int32_t>(in, imageHeader.widthPPM)
78-
|| !celutil::readLE<std::int32_t>(in, imageHeader.heightPPM)
79-
|| !celutil::readLE<std::uint32_t>(in, imageHeader.colorsUsed)
80-
|| !celutil::readLE<std::uint32_t>(in, imageHeader.colorsImportant))
76+
|| !util::readLE<std::uint32_t>(in, imageHeader.imageSize)
77+
|| !util::readLE<std::int32_t>(in, imageHeader.widthPPM)
78+
|| !util::readLE<std::int32_t>(in, imageHeader.heightPPM)
79+
|| !util::readLE<std::uint32_t>(in, imageHeader.colorsUsed)
80+
|| !util::readLE<std::uint32_t>(in, imageHeader.colorsImportant))
8181
{
8282
return nullptr;
8383
}

0 commit comments

Comments
 (0)