Removing named namespace from code base.
This commit is contained in:
+26
-26
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Romeo
|
||||
{
|
||||
void DB_Init(Database& db, Juliet::Arena* arena)
|
||||
void DB_Init(Database& db, Arena* arena)
|
||||
{
|
||||
printf("Entering DB_Init...\n");
|
||||
db.DbArena = arena;
|
||||
@@ -17,10 +17,10 @@ namespace Romeo
|
||||
struct ScanContext
|
||||
{
|
||||
Database* Db;
|
||||
Juliet::Arena* TempArena;
|
||||
Arena* TempArena;
|
||||
};
|
||||
|
||||
static void ProcessFile(ScanContext& ctx, const Juliet::String& path, const WIN32_FIND_DATAW& findData)
|
||||
static void ProcessFile(ScanContext& ctx, const String& path, const WIN32_FIND_DATAW& findData)
|
||||
{
|
||||
// Simple filter: only .h and .cpp
|
||||
const char* pPath = CStr(path);
|
||||
@@ -67,7 +67,7 @@ namespace Romeo
|
||||
FileEntry* entry = nullptr;
|
||||
for (FileEntry& e : ctx.Db->Entries)
|
||||
{
|
||||
Juliet::String dbPath = e.HeaderPath.Size > 0 ? e.HeaderPath : e.CppPath;
|
||||
String dbPath = e.HeaderPath.Size > 0 ? e.HeaderPath : e.CppPath;
|
||||
if (dbPath.Size > 0)
|
||||
{
|
||||
const char* pDbPath = CStr(dbPath);
|
||||
@@ -102,22 +102,22 @@ namespace Romeo
|
||||
|
||||
if (isHeader)
|
||||
{
|
||||
entry->HeaderPath = Juliet::StringCopy(ctx.Db->DbArena, path);
|
||||
entry->HeaderPath = StringCopy(ctx.Db->DbArena, path);
|
||||
entry->LastModifiedHeader = lastModified;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->CppPath = Juliet::StringCopy(ctx.Db->DbArena, path);
|
||||
entry->CppPath = StringCopy(ctx.Db->DbArena, path);
|
||||
entry->LastModifiedCpp = lastModified;
|
||||
}
|
||||
}
|
||||
|
||||
static void ScanDirectoryRecursive(ScanContext& ctx, const Juliet::String& currentDir)
|
||||
static void ScanDirectoryRecursive(ScanContext& ctx, const String& currentDir)
|
||||
{
|
||||
size_t searchPathLen = currentDir.Size + 3; // "\*" + null
|
||||
char* searchPathBuf = ArenaPushArray<char>(ctx.TempArena, searchPathLen JULIET_DEBUG_PARAM("RomeoDbSearchPathBuf"));
|
||||
snprintf(searchPathBuf, searchPathLen, "%s\\*", CStr(currentDir));
|
||||
Juliet::String searchPath = {searchPathBuf, searchPathLen - 1};
|
||||
String searchPath = {searchPathBuf, searchPathLen - 1};
|
||||
|
||||
// Convert to wide string for Win32
|
||||
int wLen = MultiByteToWideChar(CP_UTF8, 0, CStr(searchPath), -1, nullptr, 0);
|
||||
@@ -152,7 +152,7 @@ namespace Romeo
|
||||
size_t fullPathLen = currentDir.Size + 1 + static_cast<size_t>(uLen); // "\" + null
|
||||
char* fullPathBuf = ArenaPushArray<char>(ctx.TempArena, fullPathLen JULIET_DEBUG_PARAM("RomeoDbFullPathBuf"));
|
||||
snprintf(fullPathBuf, fullPathLen, "%s\\%s", CStr(currentDir), uFileName);
|
||||
Juliet::String fullPath = {fullPathBuf, fullPathLen - 1};
|
||||
String fullPath = {fullPathBuf, fullPathLen - 1};
|
||||
|
||||
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ namespace Romeo
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
void DB_ScanWorkspace(Database& db, Juliet::Arena* tempArena, const Juliet::String& rootDir)
|
||||
void DB_ScanWorkspace(Database& db, Arena* tempArena, const String& rootDir)
|
||||
{
|
||||
Assert(tempArena != nullptr);
|
||||
ScanContext ctx;
|
||||
@@ -186,7 +186,7 @@ namespace Romeo
|
||||
{
|
||||
snprintf(srcDirBuf, sizeof(srcDirBuf), "%s\\Juliet\\src", CStr(rootDir));
|
||||
}
|
||||
Juliet::String srcDir = Juliet::StringCopy(tempArena, Juliet::WrapString(srcDirBuf));
|
||||
String srcDir = StringCopy(tempArena, WrapString(srcDirBuf));
|
||||
|
||||
char incDirBuf[512];
|
||||
snprintf(incDirBuf, sizeof(incDirBuf), "%s\\include", CStr(rootDir));
|
||||
@@ -195,13 +195,13 @@ namespace Romeo
|
||||
{
|
||||
snprintf(incDirBuf, sizeof(incDirBuf), "%s\\Juliet\\include", CStr(rootDir));
|
||||
}
|
||||
Juliet::String incDir = Juliet::StringCopy(tempArena, Juliet::WrapString(incDirBuf));
|
||||
String incDir = StringCopy(tempArena, WrapString(incDirBuf));
|
||||
|
||||
ScanDirectoryRecursive(ctx, srcDir);
|
||||
ScanDirectoryRecursive(ctx, incDir);
|
||||
}
|
||||
|
||||
bool DB_Save(const Database& db, const Juliet::String& filePath)
|
||||
bool DB_Save(const Database& db, const String& filePath)
|
||||
{
|
||||
FILE* file = nullptr;
|
||||
if (fopen_s(&file, CStr(filePath), "wb") != 0 || !file)
|
||||
@@ -216,11 +216,11 @@ namespace Romeo
|
||||
{
|
||||
uint64_t hLen = entry.HeaderPath.Size;
|
||||
fwrite(&hLen, sizeof(uint64_t), 1, file);
|
||||
if (hLen > 0) fwrite(entry.HeaderPath.Data, 1, static_cast<size_t>(hLen), file);
|
||||
if (hLen > 0) fwrite(entry.HeaderPath.Str, 1, static_cast<size_t>(hLen), file);
|
||||
|
||||
uint64_t cLen = entry.CppPath.Size;
|
||||
fwrite(&cLen, sizeof(uint64_t), 1, file);
|
||||
if (cLen > 0) fwrite(entry.CppPath.Data, 1, static_cast<size_t>(cLen), file);
|
||||
if (cLen > 0) fwrite(entry.CppPath.Str, 1, static_cast<size_t>(cLen), file);
|
||||
|
||||
fwrite(&entry.LastModifiedHeader, sizeof(uint64_t), 1, file);
|
||||
fwrite(&entry.LastModifiedCpp, sizeof(uint64_t), 1, file);
|
||||
@@ -229,14 +229,14 @@ namespace Romeo
|
||||
|
||||
uint64_t dLen = entry.Description.Size;
|
||||
fwrite(&dLen, sizeof(uint64_t), 1, file);
|
||||
if (dLen > 0) fwrite(entry.Description.Data, 1, static_cast<size_t>(dLen), file);
|
||||
if (dLen > 0) fwrite(entry.Description.Str, 1, static_cast<size_t>(dLen), file);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DB_Load(Database& db, const Juliet::String& filePath)
|
||||
bool DB_Load(Database& db, const String& filePath)
|
||||
{
|
||||
FILE* file = nullptr;
|
||||
if (fopen_s(&file, CStr(filePath), "rb") != 0 || !file)
|
||||
@@ -261,20 +261,20 @@ namespace Romeo
|
||||
if (fread(&hLen, sizeof(uint64_t), 1, file) != 1) break;
|
||||
if (hLen > 0)
|
||||
{
|
||||
entry.HeaderPath.Data = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(hLen + 1) JULIET_DEBUG_PARAM("DbLoadHeader"));
|
||||
entry.HeaderPath.Str = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(hLen + 1) JULIET_DEBUG_PARAM("DbLoadHeader"));
|
||||
entry.HeaderPath.Size = static_cast<size_t>(hLen);
|
||||
fread(entry.HeaderPath.Data, 1, static_cast<size_t>(hLen), file);
|
||||
entry.HeaderPath.Data[hLen] = '\0';
|
||||
fread(entry.HeaderPath.Str, 1, static_cast<size_t>(hLen), file);
|
||||
entry.HeaderPath.Str[hLen] = '\0';
|
||||
}
|
||||
|
||||
uint64_t cLen = 0;
|
||||
if (fread(&cLen, sizeof(uint64_t), 1, file) != 1) break;
|
||||
if (cLen > 0)
|
||||
{
|
||||
entry.CppPath.Data = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(cLen + 1) JULIET_DEBUG_PARAM("DbLoadCpp"));
|
||||
entry.CppPath.Str = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(cLen + 1) JULIET_DEBUG_PARAM("DbLoadCpp"));
|
||||
entry.CppPath.Size = static_cast<size_t>(cLen);
|
||||
fread(entry.CppPath.Data, 1, static_cast<size_t>(cLen), file);
|
||||
entry.CppPath.Data[cLen] = '\0';
|
||||
fread(entry.CppPath.Str, 1, static_cast<size_t>(cLen), file);
|
||||
entry.CppPath.Str[cLen] = '\0';
|
||||
}
|
||||
|
||||
fread(&entry.LastModifiedHeader, sizeof(uint64_t), 1, file);
|
||||
@@ -286,10 +286,10 @@ namespace Romeo
|
||||
if (fread(&dLen, sizeof(uint64_t), 1, file) != 1) break;
|
||||
if (dLen > 0)
|
||||
{
|
||||
entry.Description.Data = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(dLen + 1) JULIET_DEBUG_PARAM("DbLoadDesc"));
|
||||
entry.Description.Str = ArenaPushArray<char>(db.DbArena, static_cast<size_t>(dLen + 1) JULIET_DEBUG_PARAM("DbLoadDesc"));
|
||||
entry.Description.Size = static_cast<size_t>(dLen);
|
||||
fread(entry.Description.Data, 1, static_cast<size_t>(dLen), file);
|
||||
entry.Description.Data[dLen] = '\0';
|
||||
fread(entry.Description.Str, 1, static_cast<size_t>(dLen), file);
|
||||
entry.Description.Str[dLen] = '\0';
|
||||
}
|
||||
|
||||
db.Entries.PushBack(entry);
|
||||
|
||||
Reference in New Issue
Block a user