- formatting

Tue, 16 Dec 2014 03:30:15 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 16 Dec 2014 03:30:15 +0200
changeset 60
268721e6be20
parent 59
00a084f8ed26
child 61
cdf3c8af1545

- formatting

sources/basics.h file | annotate | diff | comparison | revisions
sources/coloredline.h file | annotate | diff | comparison | revisions
sources/format.cpp file | annotate | diff | comparison | revisions
sources/format.h file | annotate | diff | comparison | revisions
sources/mystring.h file | annotate | diff | comparison | revisions
--- a/sources/basics.h	Tue Dec 16 03:27:54 2014 +0200
+++ b/sources/basics.h	Tue Dec 16 03:30:15 2014 +0200
@@ -44,6 +44,11 @@
 using std::min;
 using std::max;
 
+template<typename Signature>
+using Function = std::function<Signature>;
+
+// -------------------------------------------------------------------------------------------------
+//
 enum Color
 {
 	BLACK,
@@ -59,15 +64,18 @@
 	NUM_COLORS
 };
 
-template<typename Signature>
-using Function = std::function<Signature>;
-
+// -------------------------------------------------------------------------------------------------
+//
 FUNCTION print_to_console (String a) -> void;
 
+// -------------------------------------------------------------------------------------------------
+//
 template<typename T> inline FUNCTION
 clamp (T a, T b, T c) -> T
 {
 	return (a < b) ? b : (a > c) ? c : a;
 }
 
+// -------------------------------------------------------------------------------------------------
+//
 struct Exitception {};
--- a/sources/coloredline.h	Tue Dec 16 03:27:54 2014 +0200
+++ b/sources/coloredline.h	Tue Dec 16 03:30:15 2014 +0200
@@ -31,6 +31,8 @@
 #pragma once
 #include "main.h"
 
+// -------------------------------------------------------------------------------------------------
+//
 enum
 {
 	RLINE_ON_BLACK = 256,
@@ -53,6 +55,8 @@
 	RLINE_OFF_BOLD,
 };
 
+// -------------------------------------------------------------------------------------------------
+//
 class ColoredLine
 {
 public:
--- a/sources/format.cpp	Tue Dec 16 03:27:54 2014 +0200
+++ b/sources/format.cpp	Tue Dec 16 03:30:15 2014 +0200
@@ -32,6 +32,7 @@
 #include "format.h"
 
 // -------------------------------------------------------------------------------------------------
+//
 // Throws an error while formatting the string
 //
 static auto format_error (String fmtstr, const String errdescribe, int pos) -> void
@@ -48,6 +49,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // Main formatter algorithm.
 //
 auto format_args (const String& fmtstr, const Vector<String>& args) -> String
--- a/sources/format.h	Tue Dec 16 03:27:54 2014 +0200
+++ b/sources/format.h	Tue Dec 16 03:30:15 2014 +0200
@@ -36,10 +36,8 @@
 #define FORMAT_OVERLOAD(...) \
 	inline FUNCTION make_format_argument (__VA_ARGS__ a) -> String
 
-//
 // -------------------------------------------------------------------------------------------------
 //
-
 FORMAT_OVERLOAD (String) { return a; }
 FORMAT_OVERLOAD (char) { return String (a); }
 FORMAT_OVERLOAD (int) { return String::from_number (a); }
@@ -107,11 +105,13 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // Formats the given string with the given args.
 //
 FUNCTION format_args (const String& fmtstr, const Vector<String>& args) -> String;
 
 // -------------------------------------------------------------------------------------------------
+//
 // Expands the given arguments into a vector of strings.
 //
 template<typename T, typename... RestTypes> FUNCTION
@@ -158,6 +158,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // This is an overload of format() where no arguments are supplied.
 // It returns the formatter string as-is.
 //
@@ -169,6 +170,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // Prints the formatting result to the given file handle
 //
 template<typename... Args> FUNCTION
@@ -178,6 +180,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // Appends the formatting result to the given filename, if opening it succeeds
 //
 template<typename... argtypes>
@@ -193,6 +196,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
+//
 // Prints the formatting result to the console
 //
 template<typename... argtypes>
--- a/sources/mystring.h	Tue Dec 16 03:27:54 2014 +0200
+++ b/sources/mystring.h	Tue Dec 16 03:30:15 2014 +0200
@@ -39,7 +39,7 @@
 class StringList;
 
 // -------------------------------------------------------------------------------------------------
-
+//
 class String
 {
 public:
@@ -131,7 +131,7 @@
 };
 
 // -------------------------------------------------------------------------------------------------
-
+//
 class StringList : public List<String>
 {
 public:
@@ -143,12 +143,12 @@
 };
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline FUNCTION operator== (const char* a, const String& b) -> bool;
 inline FUNCTION operator+ (const char* a, const String& b) -> String;
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::is_empty() const -> bool
 {
@@ -156,7 +156,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::append (const char* data) -> void
 {
@@ -164,7 +164,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::append (char data) -> void
 {
@@ -172,7 +172,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::append (const String& data) -> void
 {
@@ -180,7 +180,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::begin() -> std::string::iterator
 {
@@ -188,7 +188,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::begin() const -> std::string::const_iterator
 {
@@ -196,14 +196,14 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline const char* String::chars() const
 {
 	return m_string.c_str();
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::end() -> std::string::iterator
 {
@@ -211,7 +211,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::end() const -> std::string::const_iterator
 {
@@ -219,7 +219,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::clear() -> void
 {
@@ -227,7 +227,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::remove_at (int pos) -> void
 {
@@ -235,7 +235,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::insert (int pos, char c) -> void
 {
@@ -251,7 +251,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::length() const -> int
 {
@@ -259,7 +259,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::remove (int pos, int len) -> void
 {
@@ -267,7 +267,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::remove_from_start (int len) -> void
 {
@@ -275,7 +275,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::remove_from_end (int len) -> void
 {
@@ -283,7 +283,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::replace (int pos, int n, const String& a) -> void
 {
@@ -291,7 +291,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::shrink_to_fit() -> void
 {
@@ -299,14 +299,14 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline const std::string& String::std_string() const
 {
 	return m_string;
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::strip (char unwanted) -> String
 {
@@ -314,7 +314,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator+ (int num) const -> String
 {
@@ -322,7 +322,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator+= (const String& data) -> String&
 {
@@ -331,7 +331,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator+= (const char* data) -> String&
 {
@@ -340,7 +340,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator+= (int num) -> String&
 {
@@ -348,7 +348,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::prepend (String a) -> void
 {
@@ -365,7 +365,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator== (const String& other) const -> bool
 {
@@ -373,7 +373,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator== (const char* other) const -> bool
 {
@@ -381,7 +381,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator!= (const String& other) const -> bool
 {
@@ -389,7 +389,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator!= (const char* other) const -> bool
 {
@@ -397,7 +397,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator> (const String& other) const -> bool
 {
@@ -405,7 +405,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::operator< (const String& other) const -> bool
 {
@@ -413,21 +413,21 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline String::operator const char*() const
 {
 	return chars();
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline String::operator const std::string&() const
 {
 	return std_string();
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::modify_index (int& a) -> void
 {
@@ -436,7 +436,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline METHOD
 String::index_difference (int a, int b) -> int
 {
@@ -446,7 +446,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline FUNCTION
 operator== (const char* a, const String& b) -> bool
 {
@@ -454,7 +454,7 @@
 }
 
 // -------------------------------------------------------------------------------------------------
-
+//
 inline FUNCTION
 operator+ (const char* a, const String& b) -> String
 {

mercurial