Files
test2/intern/ghost/intern/GHOST_SystemPathsCocoa.hh
Jonas Holzman b427253a4d Obj-C Refactor: General Code Style cleanups
As part of a more general Objective-C GHOST refactor and in an effort to
modernize the macOS backend for further works, this commit cleans up the
codestyle of Objective-C files. Based off the Blender C/C++ style guide,
in addition to some Objective-C specific style changes.

Changes:
- `const` correctness, use nullptr, initializer list for simple struct
- Reduced variable scope for simple functions, removed unused variables
- Use braces for conditional statements, no else after return
- Annotate inheritted function of GHOST Cocoa classes with override and
  use `= default` to define trivial constructors
- Use #import instead of #include for Objective-C headers
    This is only for correctness. As the Objective-C #import directive
    is really just an #include with an implicit #pragma once.
- Use proper C-style comments instead of #pragma mark
    #pragma mark is an XCode feature to mark code chapters, to follow
    the Blender codestyle, and make the Objective-C code more editor
    agnostic, these were replaced with multi-line C-style comments.

Ref #126772

Pull Request: https://projects.blender.org/blender/blender/pulls/126770
2024-09-19 11:37:52 +02:00

60 lines
1.7 KiB
C++

/* SPDX-FileCopyrightText: 2010 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup GHOST
*/
#pragma once
#ifndef __APPLE__
# error Apple OSX only!
#endif // __APPLE__
#include "GHOST_SystemPaths.hh"
class GHOST_SystemPathsCocoa : public GHOST_SystemPaths {
public:
/**
* Constructor.
*/
GHOST_SystemPathsCocoa() = default;
/**
* Destructor.
*/
~GHOST_SystemPathsCocoa() override = default;
/**
* Determine the base directory in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system directory (eg `/usr/share/blender/`).
*/
const char *getSystemDir(int version, const char *versionstr) const override;
/**
* Determine the base directory in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user directory (eg `~/.blender/`).
*/
const char *getUserDir(int version, const char *versionstr) const override;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user directory (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const override;
/**
* Determine the directory of the current binary.
* \return Unsigned char string pointing to the binary directory.
*/
const char *getBinaryDir() const override;
/**
* Add the file to the operating system most recently used files
*/
void addToSystemRecentFiles(const char *filepath) const override;
};