remove app namespace

This commit is contained in:
scawful
2024-12-28 21:28:51 -05:00
parent 3ebe17c7bd
commit e05e7c35db
174 changed files with 475 additions and 658 deletions

View File

@@ -13,7 +13,6 @@
#include "absl/strings/string_view.h"
namespace yaze {
namespace app {
namespace core {
namespace {
@@ -329,5 +328,5 @@ absl::StatusOr<std::string> CheckVersion(const char *version) {
}
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -12,10 +12,9 @@
#include "absl/container/flat_hash_map.h"
namespace yaze {
namespace app {
/**
* @namespace yaze::app::core
* @namespace yaze::core
* @brief Core application logic and utilities.
*/
namespace core {
@@ -313,7 +312,7 @@ constexpr std::string_view kYazeVersion = "0.2.1";
absl::StatusOr<std::string> CheckVersion(const char *version);
} // namespace core
} // namespace app
} // namespace yaze
#endif

View File

@@ -16,7 +16,6 @@
#include "imgui/imgui.h"
namespace yaze {
namespace app {
namespace core {
namespace {
@@ -278,5 +277,5 @@ absl::Status Controller::LoadConfigFiles() {
}
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -18,7 +18,6 @@
int main(int argc, char **argv);
namespace yaze {
namespace app {
namespace core {
/**
@@ -71,7 +70,7 @@ class Controller : public ExperimentFlags {
};
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_CONTROLLER_H

View File

@@ -206,8 +206,8 @@
}
- (void)openFileAction:(id)sender {
if (!yaze::app::SharedRom::shared_rom_
->LoadFromFile(yaze::app::core::FileDialogWrapper::ShowOpenFileDialog())
if (!yaze::SharedRom::shared_rom_
->LoadFromFile(yaze::core::FileDialogWrapper::ShowOpenFileDialog())
.ok()) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Error"];
@@ -238,7 +238,7 @@ extern "C" void yaze_initialize_cococa() {
extern "C" void yaze_run_cocoa_app_delegate(const char *filename) {
yaze_initialize_cococa();
yaze::app::core::Controller controller;
yaze::core::Controller controller;
RETURN_VOID_IF_ERROR(controller.OnEntry(filename));
while (controller.IsActive()) {
@autoreleasepool {

View File

@@ -4,7 +4,6 @@
#include <vector>
namespace yaze {
namespace app {
namespace core {
void CopyImageToClipboard(const std::vector<uint8_t>& data) {}
@@ -12,5 +11,4 @@ void GetImageFromClipboard(std::vector<uint8_t>& data, int& width,
int& height) {}
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -5,14 +5,12 @@
#include <vector>
namespace yaze {
namespace app {
namespace core {
void CopyImageToClipboard(const std::vector<uint8_t> &data);
void GetImageFromClipboard(std::vector<uint8_t> &data, int &width, int &height);
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_PLATFORM_CLIPBOARD_H

View File

@@ -6,7 +6,7 @@
#ifdef TARGET_OS_MAC
#import <Cocoa/Cocoa.h>
void yaze::app::core::CopyImageToClipboard(const std::vector<uint8_t>& pngData) {
void yaze::core::CopyImageToClipboard(const std::vector<uint8_t>& pngData) {
NSData* data = [NSData dataWithBytes:pngData.data() length:pngData.size()];
NSImage* image = [[NSImage alloc] initWithData:data];
@@ -15,7 +15,7 @@ void yaze::app::core::CopyImageToClipboard(const std::vector<uint8_t>& pngData)
[pasteboard writeObjects:@[ image ]];
}
void yaze::app::core::GetImageFromClipboard(std::vector<uint8_t>& pixel_data, int& width, int& height) {
void yaze::core::GetImageFromClipboard(std::vector<uint8_t>& pixel_data, int& width, int& height) {
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSArray* classArray = [NSArray arrayWithObject:[NSImage class]];
NSDictionary* options = [NSDictionary dictionary];

View File

@@ -7,12 +7,11 @@
#endif // _WIN32
namespace yaze {
namespace app {
namespace core {
#ifdef _WIN32
std::string FileDialogWrapper::ShowOpenFileDialog() {
std::string FileDialogWrapper::ShowOpenFileDialog() {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
IFileDialog *pfd = NULL;
@@ -44,7 +43,7 @@ namespace core {
return file_path_windows;
}
std::string FileDialogWrapper::ShowOpenFolderDialog() {
std::string FileDialogWrapper::ShowOpenFolderDialog() {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
IFileDialog *pfd = NULL;
@@ -141,5 +140,4 @@ std::vector<std::string> FileDialogWrapper::GetFilesInFolder(
#endif
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -5,7 +5,6 @@
#include <vector>
namespace yaze {
namespace app {
namespace core {
class FileDialogWrapper {
@@ -28,7 +27,6 @@ class FileDialogWrapper {
};
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_PLATFORM_FILE_DIALOG_H

View File

@@ -37,20 +37,18 @@ std::string ShowOpenFileDialogSync() {
return result;
}
}
} // namespace
std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() {
return ShowOpenFileDialogSync();
}
std::string yaze::core::FileDialogWrapper::ShowOpenFileDialog() { return ShowOpenFileDialogSync(); }
std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() { return ""; }
std::string yaze::core::FileDialogWrapper::ShowOpenFolderDialog() { return ""; }
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetFilesInFolder(
std::vector<std::string> yaze::core::FileDialogWrapper::GetFilesInFolder(
const std::string &folder) {
return {};
}
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetSubdirectoriesInFolder(
std::vector<std::string> yaze::core::FileDialogWrapper::GetSubdirectoriesInFolder(
const std::string &folder) {
return {};
}
@@ -60,7 +58,7 @@ std::vector<std::string> yaze::app::core::FileDialogWrapper::GetSubdirectoriesIn
#import <Cocoa/Cocoa.h>
std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() {
std::string yaze::core::FileDialogWrapper::ShowOpenFileDialog() {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:YES];
[openPanel setCanChooseDirectories:NO];
@@ -75,7 +73,7 @@ std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() {
return "";
}
std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() {
std::string yaze::core::FileDialogWrapper::ShowOpenFolderDialog() {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:NO];
[openPanel setCanChooseDirectories:YES];
@@ -90,7 +88,7 @@ std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() {
return "";
}
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetFilesInFolder(
std::vector<std::string> yaze::core::FileDialogWrapper::GetFilesInFolder(
const std::string& folder) {
std::vector<std::string> filenames;
NSFileManager* fileManager = [NSFileManager defaultManager];
@@ -106,7 +104,7 @@ std::vector<std::string> yaze::app::core::FileDialogWrapper::GetFilesInFolder(
return filenames;
}
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetSubdirectoriesInFolder(
std::vector<std::string> yaze::core::FileDialogWrapper::GetSubdirectoriesInFolder(
const std::string& folder) {
std::vector<std::string> subdirectories;
NSFileManager* fileManager = [NSFileManager defaultManager];

View File

@@ -4,7 +4,6 @@
#include <string>
namespace yaze {
namespace app {
namespace core {
/**
@@ -14,7 +13,6 @@ namespace core {
std::string GetBundleResourcePath();
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_PLATFORM_FILE_PATH_H

View File

@@ -8,14 +8,14 @@
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
std::string yaze::app::core::GetBundleResourcePath() {
std::string yaze::core::GetBundleResourcePath() {
NSBundle* bundle = [NSBundle mainBundle];
NSString* resourceDirectoryPath = [bundle bundlePath];
NSString* path = [resourceDirectoryPath stringByAppendingString:@"/"];
return [path UTF8String];
}
#elif TARGET_OS_MAC == 1
std::string yaze::app::core::GetBundleResourcePath() {
std::string yaze::core::GetBundleResourcePath() {
NSBundle* bundle = [NSBundle mainBundle];
NSString* resourceDirectoryPath = [bundle bundlePath];
NSString* path = [resourceDirectoryPath stringByAppendingString:@"/"];

View File

@@ -13,7 +13,6 @@
#include "imgui/imgui.h"
namespace yaze {
namespace app {
namespace core {
absl::Status LoadPackageFonts() {
@@ -240,5 +239,4 @@ void LoadSystemFonts() {
#endif
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -4,14 +4,12 @@
#include "absl/status/status.h"
namespace yaze {
namespace app {
namespace core {
void LoadSystemFonts();
absl::Status LoadPackageFonts();
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_PLATFORM_FONTLOADER_H

View File

@@ -8,13 +8,13 @@
#if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1
/* iOS */
void yaze::app::core::LoadSystemFonts() {}
void yaze::core::LoadSystemFonts() {}
#elif TARGET_OS_MAC == 1
/* macOS */
#import <Cocoa/Cocoa.h>
void yaze::app::core::LoadSystemFonts() {
void yaze::core::LoadSystemFonts() {
NSArray *fontNames = @[ @"Helvetica", @"Times New Roman", @"Courier", @"Arial", @"Verdana" ];
for (NSString *fontName in fontNames) {

View File

@@ -11,7 +11,6 @@
#include "app/gfx/bitmap.h"
namespace yaze {
namespace app {
namespace core {
/**
@@ -77,7 +76,6 @@ class Renderer {
};
} // namespace core
} // namespace app
} // namespace yaze
#endif

View File

@@ -10,7 +10,7 @@
@end
#else
@interface AppViewController : UIViewController <MTKViewDelegate>
@property(nonatomic) yaze::app::core::Controller *controller;
@property(nonatomic) yaze::core::Controller *controller;
@property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer;
@property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer;
@property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer;

View File

@@ -9,7 +9,6 @@
#include "imgui/misc/cpp/imgui_stdlib.h"
namespace yaze {
namespace app {
absl::Status Project::Open(const std::string& project_path) {
filepath = project_path;
@@ -185,5 +184,5 @@ std::string ResourceLabelManager::CreateOrGetLabel(
return labels_[type][key];
}
} // namespace app
} // namespace yaze

View File

@@ -11,7 +11,6 @@
#include "app/core/utils/file_util.h"
namespace yaze {
namespace app {
const std::string kRecentFilesFilename = "recent_files.txt";
constexpr char kEndOfProjectFile[] = "EndOfProjectFile";
@@ -130,7 +129,7 @@ class RecentFilesManager {
std::vector<std::string> recent_files_;
};
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_PROJECT_H

View File

@@ -11,7 +11,6 @@
#include <sstream>
namespace yaze {
namespace app {
namespace core {
std::string GetFileExtension(const std::string &filename) {
@@ -70,5 +69,4 @@ std::string GetConfigDirectory(Platform platform) {
}
} // namespace core
} // namespace app
} // namespace yaze

View File

@@ -4,7 +4,6 @@
#include <string>
namespace yaze {
namespace app {
namespace core {
enum class Platform { kUnknown, kMacOS, kiOS, kWindows, kLinux };
@@ -17,8 +16,7 @@ std::string GetConfigDirectory(Platform platform);
void SaveFile(const std::string &filename, const std::string &data,
Platform platform);
} // namespace core
} // namespace app
} // namespace yaze
} // namespace core
} // namespace yaze
#endif // YAZE_APP_CORE_UTILS_FILE_UTIL_H
#endif // YAZE_APP_CORE_UTILS_FILE_UTIL_H

View File

@@ -4,7 +4,6 @@
#include <SDL.h>
namespace yaze {
namespace app {
namespace core {
/**
@@ -19,22 +18,17 @@ struct SDL_Deleter {
* @brief Deleter for SDL_Texture.
*/
struct SDL_Texture_Deleter {
void operator()(SDL_Texture *p) const {
SDL_DestroyTexture(p);
}
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
};
/**
* @brief Deleter for SDL_Surface.
*/
struct SDL_Surface_Deleter {
void operator()(SDL_Surface *p) const {
SDL_FreeSurface(p);
}
void operator()(SDL_Surface *p) const { SDL_FreeSurface(p); }
};
} // namespace core
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_UTILS_SDL_DELETER_H_