Cleanup: indentation of public/protected/private keywords

This commit is contained in:
Twan van Laarhoven
2020-05-12 21:57:37 +02:00
parent 86aec577a2
commit 0c3712b61a
167 changed files with 751 additions and 752 deletions
+4 -4
View File
@@ -19,7 +19,7 @@
* It must store the necessary information to also undo the action.
*/
class Action {
public:
public:
virtual ~Action() {};
/// Name of the action, for use in strings like "Undo <name>"
@@ -46,7 +46,7 @@ class Action {
/// Base class/interface for objects that listen to actions
class ActionListener {
public:
public:
virtual ~ActionListener() {}
/// Notification that an action a has been performed or undone
virtual void onAction(const Action& a, bool undone) = 0;
@@ -61,7 +61,7 @@ class ActionListener {
* They will be notified when an action is added.
*/
class ActionStack {
public:
public:
ActionStack();
/// Add an action to the stack, and perform that action.
@@ -103,7 +103,7 @@ class ActionStack {
/// Tell all listeners about an action
void tellListeners(const Action&, bool undone);
private:
private:
/// Actions to be undone.
vector<unique_ptr<Action>> undo_actions;
/// Actions to be redone
+2 -2
View File
@@ -18,7 +18,7 @@
*/
template <typename T>
class Defaultable {
public:
public:
inline Defaultable() : is_default(true) {}
inline Defaultable(const T& v, bool def = false) : value(v), is_default(def) {}
@@ -57,7 +57,7 @@ class Defaultable {
/** used by scriptable to check for changes */
inline bool operator != (const Defaultable& that) const { return value != that.value; }
private:
private:
/// The value
T value;
/// Is this value in the default state?
+31 -31
View File
@@ -51,41 +51,41 @@ String Error::what() const {
// Stolen from wx/appbase.cpp
// we can't just call it, because of static linkage
#if wxUSE_STACKWALKER
String get_stack_trace() {
String get_stack_trace() {
wxString stackTrace;
class StackDumper : public wxStackWalker {
public:
StackDumper() {}
public:
StackDumper() {}
const wxString& GetStackTrace() const { return m_stackTrace; }
const wxString& GetStackTrace() const { return m_stackTrace; }
protected:
virtual void OnStackFrame(const wxStackFrame& frame) {
m_stackTrace << wxString::Format(_("[%02d] "), frame.GetLevel());
protected:
virtual void OnStackFrame(const wxStackFrame& frame) {
m_stackTrace << wxString::Format(_("[%02d] "), frame.GetLevel());
wxString name = frame.GetName();
if ( !name.empty() ) {
m_stackTrace << wxString::Format(_("%-40s"), name.c_str());
} else {
m_stackTrace << wxString::Format(
_("%p"),
(void*)frame.GetAddress()
);
}
if ( frame.HasSourceLocation() ) {
m_stackTrace << _('\t')
<< frame.GetFileName()
<< _(':')
<< (unsigned int)frame.GetLine();
}
m_stackTrace << _('\n');
wxString name = frame.GetName();
if ( !name.empty() ) {
m_stackTrace << wxString::Format(_("%-40s"), name.c_str());
} else {
m_stackTrace << wxString::Format(
_("%p"),
(void*)frame.GetAddress()
);
}
private:
wxString m_stackTrace;
if ( frame.HasSourceLocation() ) {
m_stackTrace << _('\t')
<< frame.GetFileName()
<< _(':')
<< (unsigned int)frame.GetLine();
}
m_stackTrace << _('\n');
}
private:
wxString m_stackTrace;
};
StackDumper dump;
@@ -101,11 +101,11 @@ String get_stack_trace() {
stackTrace = stackTrace.BeforeLast(wxT('\n'));
return stackTrace;
}
}
#else
String get_stack_trace() {
return _(""); // not supported
}
String get_stack_trace() {
return _(""); // not supported
}
#endif // wxUSE_STACKWALKER
InternalError::InternalError(const String& str)
+14 -14
View File
@@ -19,7 +19,7 @@
/// Our own exception class
class Error {
public:
public:
Error(const String& message);
virtual ~Error();
@@ -28,14 +28,14 @@ class Error {
/// Is the message (potentially) fatal?
virtual bool is_fatal() const { return false; }
protected:
protected:
String message; ///< The error message
};
/// Internal errors
class InternalError : public Error {
public:
public:
InternalError(const String& str);
// not all internal errors are fatal, but we had still better warn the user about them.
virtual bool is_fatal() const { return true; }
@@ -45,19 +45,19 @@ class InternalError : public Error {
/// Errors related to packages
class PackageError : public Error {
public:
public:
inline PackageError(const String& str) : Error(str) {}
};
/// A package is not found
class PackageNotFoundError : public PackageError {
public:
public:
inline PackageNotFoundError(const String& str) : PackageError(str) {}
};
/// A file is not found
class FileNotFoundError : public PackageError {
public:
public:
inline FileNotFoundError(const String& file, const String& package)
: PackageError(_ERROR_2_("file not found", file, package))
{}
@@ -67,13 +67,13 @@ class FileNotFoundError : public PackageError {
/// Parse errors
class ParseError : public Error {
public:
public:
inline ParseError(const String& str) : Error(str) {}
};
/// Parse error in a particular file
class FileParseError : public ParseError {
public:
public:
inline FileParseError(const String& err, const String& file) :
ParseError(_ERROR_2_("file parse error", file, err))
{}
@@ -81,7 +81,7 @@ class FileParseError : public ParseError {
/// Parse error in a script
class ScriptParseError : public ParseError {
public:
public:
ScriptParseError(size_t pos, int line, const String& filename, const String& str);
ScriptParseError(size_t pos, int line, const String& filename, const String& expected, const String& found);
ScriptParseError(size_t pos1, size_t pos2, int line, const String& filename, const String& open, const String& close, const String& found);
@@ -97,7 +97,7 @@ class ScriptParseError : public ParseError {
/// Multiple parse errors in a script
class ScriptParseErrors : public ParseError {
public:
public:
ScriptParseErrors(const vector<ScriptParseError>& errors);
};
@@ -105,19 +105,19 @@ class ScriptParseErrors : public ParseError {
/// A runtime error in a script
class ScriptError : public Error {
public:
public:
inline ScriptError(const String& str) : Error(str) {}
};
/// "Variable not set"
class ScriptErrorNoVariable : public ScriptError {
public:
public:
inline ScriptErrorNoVariable(const String& var) : ScriptError(_("Variable not set: ") + var) {}
};
/// "Can't convert from A to B"
class ScriptErrorConversion : public ScriptError {
public:
public:
inline ScriptErrorConversion(const String& a, const String& b)
: ScriptError(_ERROR_2_("can't convert", a, b)) {}
inline ScriptErrorConversion(const String& value, const String& a, const String& b)
@@ -126,7 +126,7 @@ class ScriptErrorConversion : public ScriptError {
/// "A has no member B"
class ScriptErrorNoMember : public ScriptError {
public:
public:
inline ScriptErrorNoMember(const String& type, const String& member)
: ScriptError(_ERROR_2_("has no member", type, member)) {}
};
+4 -4
View File
@@ -128,7 +128,7 @@ bool create_parent_dirs(const String& file) {
// ----------------------------------------------------------------------------- : Removing
class RecursiveDeleter : public wxDirTraverser {
public:
public:
RecursiveDeleter(const String& start) {
to_delete.push_back(start);
ok = true;
@@ -160,7 +160,7 @@ class RecursiveDeleter : public wxDirTraverser {
to_delete.push_back(dirname);
return wxDIR_CONTINUE;
}
private:
private:
vector<String> to_delete;
};
@@ -195,7 +195,7 @@ bool rename_file_or_dir(const String& from, const String& to) {
// ----------------------------------------------------------------------------- : Moving
class IgnoredMover : public wxDirTraverser {
public:
public:
IgnoredMover(const String& from, const String& to)
: from(from), to(to)
{}
@@ -206,7 +206,7 @@ class IgnoredMover : public wxDirTraverser {
wxDirTraverseResult OnDir(const String& dirname) {
return tryMove(dirname) ? wxDIR_IGNORE : wxDIR_CONTINUE;
}
private:
private:
String from, to;
bool tryMove(const String& from_path) {
if (is_substr(from_path,0,from)) {
+2 -2
View File
@@ -18,7 +18,7 @@ DECLARE_POINTER_TYPE(TextValue);
/// Information for search/replace
class FindInfo {
public:
public:
FindInfo(wxFindReplaceData& what) : what(what) {}
virtual ~FindInfo() {}
@@ -39,7 +39,7 @@ class FindInfo {
/// String to look for
inline const String& findString() const { return what.GetFindString(); }
protected:
protected:
wxFindReplaceData& what; ///< What to search for, the direction to search in
};
+4 -4
View File
@@ -31,7 +31,7 @@
*/
template <typename Key, typename Value>
class IndexMap : private vector<Value> {
public:
public:
using typename vector<Value>::iterator;
using typename vector<Value>::const_iterator;
using typename vector<Value>::reference;
@@ -117,7 +117,7 @@ class IndexMap : private vector<Value> {
vector<Value>::swap(b);
}
private:
private:
using vector<Value>::operator [];
};
@@ -144,12 +144,12 @@ struct DelayedIndexMapsData : public IntrusivePtrBase<DelayedIndexMapsData<Key,
*/
template <typename Key, typename Value>
class DelayedIndexMaps {
public:
public:
/// Get the data for a specific name. Initialize the map with init_with (if it is not alread initialized)
IndexMap<Key,Value>& get(const String& name, const vector<Key>& init_with);
/// Clear the delayed index map
void clear();
private:
private:
map<String, intrusive_ptr<DelayedIndexMapsData<Key,Value> > > data;
friend class Reader;
friend class Writer;
+3 -3
View File
@@ -112,7 +112,7 @@ public:
template <typename K, typename V> void handle(const DelayedIndexMaps<K,V>&);
template <typename K, typename V> void handle(const DelayedIndexMapsData<K,V>&);
private:
private:
const String& target_name; ///< The name we are looking for
GetDefaultMember gdm; ///< Object to store and retrieve the value
};
@@ -148,7 +148,7 @@ public:
/// Handler to be used when reflecting enumerations for GetMember
class EnumGetMember {
public:
public:
inline EnumGetMember(GetDefaultMember& gdm)
: gdm(gdm) {}
@@ -160,7 +160,7 @@ class EnumGetMember {
}
}
private:
private:
GetDefaultMember& gdm; ///< The object to store output in
};
+9 -9
View File
@@ -81,7 +81,7 @@ private:
* TODO: maybe support sub packages (a package inside another package)?
*/
class Package : public IntrusivePtrVirtualBase {
public:
public:
// --------------------------------------------------- : Managing the outside of the package
/// Creates a new package
@@ -181,7 +181,7 @@ class Package : public IntrusivePtrVirtualBase {
writer.handle(obj);
}
protected:
protected:
// TODO: I dislike putting this here very much. There ought to be a better way.
virtual VCSP getVCS() { return make_intrusive<VCS>(); }
@@ -208,13 +208,13 @@ class Package : public IntrusivePtrVirtualBase {
/// Last modified time
DateTime modified;
public:
public:
/// Information on files in the package
typedef map<String, FileInfo> FileInfos;
inline const FileInfos& getFileInfos() const { return files; }
/// When was a file last modified?
DateTime modificationTime(const pair<String, FileInfo>& fi) const;
private:
private:
/// All files in the package
FileInfos files;
/// Filestream/zipstream for reading zip files
@@ -244,7 +244,7 @@ class Package : public IntrusivePtrVirtualBase {
/// Dependencies of a package
class PackageDependency : public IntrusivePtrBase<PackageDependency> {
public:
public:
String package; ///< Name of the package someone depends on
vector<String> suggests; ///< Packages suggested to fulfill this dependency
Version version; ///< Minimal required version of that package
@@ -256,7 +256,7 @@ class PackageDependency : public IntrusivePtrBase<PackageDependency> {
/** When the package is opened/saved a file describing the data object is read/written
*/
class Packaged : public Package {
public:
public:
Packaged();
virtual ~Packaged() {}
@@ -290,7 +290,7 @@ class Packaged : public Package {
return fully_loaded;
}
protected:
protected:
/// filename of the data file, and extension of the package file
virtual String typeName() const = 0;
/// Can be overloaded to do validation after loading
@@ -301,7 +301,7 @@ class Packaged : public Package {
DECLARE_REFLECTION_VIRTUAL();
friend void after_reading(Packaged& p, Version file_app_version);
private:
private:
bool fully_loaded; ///< Is the package fully loaded?
friend struct JustAsPackageProxy;
friend class Installer;
@@ -315,7 +315,7 @@ inline void after_reading(Packaged& p, Version file_app_version) {
/// A package that just contains a bunch of files that are used from other packages
class IncludePackage : public Packaged {
protected:
protected:
String typeName() const;
Version fileVersion() const;
DECLARE_REFLECTION();
+8 -8
View File
@@ -23,7 +23,7 @@ class PackageDependency;
/// Information on a package in a repository
class PackageVersionData : public IntrusivePtrVirtualBase {
public:
public:
PackageVersionData() {}
String name; ///< Name of the package
@@ -58,7 +58,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(UpdateData) {
/// A directory for packages
class PackageDirectory {
public:
public:
void init(bool local);
void init(const String& dir);
@@ -88,7 +88,7 @@ class PackageDirectory {
void loadDatabase();
void saveDatabase();
private:
private:
bool is_local;
String directory;
vector<PackageVersionP> packages; // sorted by name
@@ -107,7 +107,7 @@ class PackageDirectory {
* There is a single global instance of the PackageManager, called packages
*/
class PackageManager {
public:
public:
/// Initialize the package manager
void init();
/// Empty the list of packages.
@@ -176,7 +176,7 @@ class PackageManager {
// --------------------------------------------------- : Packages on a server
private:
private:
map<String, PackagedP> loaded_packages;
PackageDirectory local, global;
};
@@ -188,7 +188,7 @@ extern PackageManager package_manager;
/// Version information for an installed package
class PackageVersion : public IntrusivePtrBase<PackageVersion> {
public:
public:
PackageVersion() : status(0) {}
PackageVersion(int status) : status(status) {}
@@ -209,7 +209,7 @@ class PackageVersion : public IntrusivePtrBase<PackageVersion> {
/// Set blessed status to true
void bless();
public:
public:
/// Status of a single file
enum FileStatus
{ FILE_UNCHANGED
@@ -228,7 +228,7 @@ class PackageVersion : public IntrusivePtrBase<PackageVersion> {
FileStatus status;
inline bool operator < (const FileInfo& f) const { return file < f.file; }
};
private:
private:
vector<FileInfo> files; // sorted by filename
DECLARE_REFLECTION();
};
+2 -2
View File
@@ -123,7 +123,7 @@ void Reader::moveNext() {
* making startup slightly faster.
*/
template <typename T> class LocalVector {
public:
public:
LocalVector() : the_size(0), alloced(SMALL_SIZE), buffer(small) {}
~LocalVector() { if (buffer != small) free(buffer); }
void push_back(T t) {
@@ -141,7 +141,7 @@ template <typename T> class LocalVector {
}
inline const T* get() const { return buffer; }
inline size_t size() const { return the_size; }
private:
private:
static const int SMALL_SIZE = 1024;
size_t the_size, alloced;
T* buffer;
+3 -3
View File
@@ -28,7 +28,7 @@ class Packaged;
* object that was just read.
*/
class Reader {
public:
public:
/// Construct a reader that reads from the given input stream
/** filename is used only for error messages
* package is used for looking up included files.
@@ -273,7 +273,7 @@ void Reader::handle(IndexMap<K,V>& m) {
/// 'Handler' to be used when reflecting enumerations for Reader
class EnumReader {
public:
public:
inline EnumReader(String const& read)
: read(read), first(nullptr), done(false) {}
@@ -295,7 +295,7 @@ class EnumReader {
void warnIfNotDone(Reader* errors_to);
void errorIfNotDone();
private:
private:
String read; ///< The string to match to a value name
Char const* first; ///< Has the first (default) value been handled? If so, what is its name.
bool done; ///< Was anything matched?
+4 -4
View File
@@ -20,7 +20,7 @@ DECLARE_POINTER_TYPE(StyleSheet);
/// The Writer can be used for writing (serializing) objects
class Writer {
public:
public:
/// Construct a writer that writes to the given output stream
Writer(OutputStream& output, Version file_app_version);
@@ -69,7 +69,7 @@ class Writer {
void handle(const GameP&);
void handle(const StyleSheetP&);
private:
private:
// --------------------------------------------------- : Data
/// Indentation of the current block
int indentation;
@@ -147,7 +147,7 @@ void Writer::handle(const IndexMap<K,V>& m) {
/// Handler to be used when reflecting enumerations for Writer
class EnumWriter {
public:
public:
inline EnumWriter(Writer& writer)
: writer(writer) {}
@@ -159,7 +159,7 @@ class EnumWriter {
}
}
private:
private:
Writer& writer; ///< The writer to write output to
};
+2 -2
View File
@@ -16,7 +16,7 @@
/** Can be used as a map "void* -> int" for finding the position of an object */
template <typename T>
class OrderCache : public IntrusivePtrBase<OrderCache<T> > {
public:
public:
/// Initialize the order cache, ordering the keys by their string values from the other vector
/** Optionally filter the list using a vector of booleans of items to keep (note: vector<bool> is evil)
* @pre keys.size() == values.size()
@@ -26,7 +26,7 @@ class OrderCache : public IntrusivePtrBase<OrderCache<T> > {
/// Find the position of the given key in the cache, returns -1 if not found
int find(const T& key) const;
private:
private:
struct CompareKeys;
struct CompareValues;
typedef pair<void*,int> KV;
+2 -2
View File
@@ -25,7 +25,7 @@ typedef Vector2D RealPoint;
/// A size (width,height) using real (double) coordinates
class RealSize {
public:
public:
double width;
double height;
@@ -125,7 +125,7 @@ inline RealSize piecewise_max(const RealSize& a, const RealSize& b) {
/// A rectangle (postion and size) using real (double) coordinats
class RealRect : private RealPoint, private RealSize {
public:
public:
using RealPoint::x;
using RealPoint::y;
using RealSize::width;
+6 -6
View File
@@ -54,7 +54,7 @@
* Has an interface like boost::regex, but compatible with wxStrings.
*/
class Regex {
public:
public:
struct Results : public boost::match_results<String::const_iterator> {
/// Get a sub match
inline String str(int sub = 0) const {
@@ -90,7 +90,7 @@
return regex.empty();
}
private:
private:
boost::basic_regex<Char> regex; ///< The regular expression
};
@@ -101,10 +101,10 @@
* Has an interface like boost::regex.
*/
class Regex
public:
public:
// Interface for compatability with boost::regex
class Results {
public:
public:
typedef pair<const Char*,const Char*> value_type; // (begin,end)
typedef value_type const_reference;
/// Number of submatches (+1 for the total match)
@@ -140,7 +140,7 @@
regex->ReplaceFirst(&inside, format);
return inside;
}
private:
private:
wxRegEx* regex;
const Char* begin;
friend class ScriptRegex;
@@ -170,7 +170,7 @@
return !regex.IsValid();
}
private:
private:
wxRegEx regex; ///< The regular expression
};
+8 -8
View File
@@ -27,7 +27,7 @@ enum RotationFlags
* tr***inv do the opposite.
*/
class Rotation {
public:
public:
/// Construct a rotation object
/** with the given rectangle of external coordinates and a given rotation angle and zoom factor.
* if is_internal then the rect gives the internal coordinates, its origin should be (0,0)
@@ -97,11 +97,11 @@ class Rotation {
/// Translate a size back to internal coordinates
RealSize trInv(const RealSize& p) const;
protected:
protected:
Radians angle; ///< The angle of rotation in radians (counterclockwise)
RealSize size; ///< Size of the rectangle, in internal coordinates
RealPoint origin; ///< tr(0,0)
double zoomX; ///< Zoom factor, zoom = 2.0 means that 1 internal = 2 external
RealPoint origin; ///< tr(0,0)
double zoomX; ///< Zoom factor, zoom = 2.0 means that 1 internal = 2 external
double zoomY;
friend class Rotater;
@@ -121,13 +121,13 @@ class Rotation {
* @endcode
*/
class Rotater {
public:
public:
/// Compose a rotation by onto the rotation rot
/** rot is restored when this object is destructed
*/
Rotater(Rotation& rot, const Rotation& by);
~Rotater();
private:
private:
Rotation old;
Rotation& rot;
};
@@ -150,7 +150,7 @@ enum RenderQuality {
/** All draw** functions take internal coordinates.
*/
class RotatedDC : public Rotation {
public:
public:
RotatedDC(DC& dc, Radians angle, const RealRect& rect, double zoom, RenderQuality quality, RotationFlags flags = ROTATION_NORMAL);
RotatedDC(DC& dc, const Rotation& rotation, RenderQuality quality);
@@ -211,7 +211,7 @@ class RotatedDC : public Rotation {
inline wxDC& getDC() { return dc; }
private:
private:
wxDC& dc; ///< The actual dc
RenderQuality quality; ///< Quality of the text
};
+2 -2
View File
@@ -19,7 +19,7 @@ String spec_sort(const String& spec, String& input, String& ret);
/// Iterator over a sort specification (for spec_sort)
class SpecIterator {
public:
public:
SpecIterator(const String& spec, size_t pos = 0)
: spec(spec), pos(pos)
{}
@@ -105,7 +105,7 @@ class SpecIterator {
return false;
}
private:
private:
const String& spec;
size_t pos;
};
+1 -1
View File
@@ -29,7 +29,7 @@ void Reader::handle(VCSP& pointer);
*/
class VCS : public IntrusivePtrVirtualBase
{
public:
public:
/// Add a file - it's assumed to already have been created
virtual void addFile (const wxFileName& filename) {
}
+1 -1
View File
@@ -14,7 +14,7 @@
// ----------------------------------------------------------------------------- : SubversionVCS
class SubversionVCS : public VCS {
public:
public:
virtual void addFile (const wxFileName& filename);
virtual void moveFile (const wxFileName& source, const wxFileName& destination);
virtual void removeFile (const wxFileName& filename);
+2 -2
View File
@@ -25,7 +25,7 @@ inline int to_int(double d) {
/// A simple 2d vector class
class Vector2D {
public:
public:
/// Coordinates of this vector
double x, y;
@@ -146,7 +146,7 @@ inline Vector2D operator * (double a, const Vector2D& b) { return b * a; }
/// A two dimensional transformation matrix, simply two vectors
class Matrix2D {
public:
public:
Vector2D mx, my;
inline Matrix2D() : mx(1,0), my(0,1) {}
+2 -2
View File
@@ -20,7 +20,7 @@
/// A version number
struct Version {
public:
public:
Version() : version(0) {}
Version(UInt version) : version(version) {}
@@ -39,7 +39,7 @@ struct Version {
/// Convert a string to a version number
static Version fromString(const String& version);
private:
private:
UInt version; ///< Version number encoded as aabbcc, where a=major, b=minor, c=revision
};