Skip to content

Commit

Permalink
Documention
Browse files Browse the repository at this point in the history
  • Loading branch information
Roffild committed Jun 18, 2018
1 parent 626fb1d commit 7cddbe3
Show file tree
Hide file tree
Showing 20 changed files with 3,001 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# gitignore
*.ex5
*.ex4
/mql5doc/
2,470 changes: 2,470 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

28 changes: 17 additions & 11 deletions Include/Roffild/ArrayList.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* https://github.com/Roffild/RoffildLibrary
*/

/// ArrayList from Java.
template<typename Type>
class CArrayList
{
Expand Down Expand Up @@ -98,6 +99,7 @@ public:
{
return addAll(ArraySize(elements), list);
}
/// Appends all of the elements in the specified collection to the end of this list.
bool addAll(const CArrayList<Type> &list)
{
return addAll(ArraySize(elements), list.elements);
Expand All @@ -123,6 +125,8 @@ public:
}
return false;
}
/// Inserts all of the elements in the specified collection into this list,
/// starting at the specified position.
bool addAll(int index, const CArrayList<Type> &list)
{
return addAll(index, list.elements);
Expand All @@ -134,7 +138,7 @@ public:
ArrayResize(elements, 0, reserve);
}

/// Returns a shallow copy of this ArrayList instance.
// / Returns a shallow copy of this ArrayList instance.
//Object clone()

/// Returns true if this list contains the specified element.
Expand All @@ -143,20 +147,21 @@ public:
return indexOf(o) > -1;
}

/// Increases the capacity of this ArrayList instance, if necessary,
/// to ensure that it can hold at least the number of elements
/// specified by the minimum capacity argument.
// / Increases the capacity of this ArrayList instance, if necessary,
// / to ensure that it can hold at least the number of elements
// / specified by the minimum capacity argument.
//void ensureCapacity(int minCapacity)

/// Performs the given action for each element of the Iterable until all elements
/// have been processed or the action throws an exception.
// / Performs the given action for each element of the Iterable until all elements
// / have been processed or the action throws an exception.
//void forEach(Consumer<? super E> action)

/// Returns the element at the specified position in this list.
Type get(int index)
{
return elements[index];
}
/// Returns the element at the specified position in this list.
Type operator[](int index)
{
return get(index);
Expand Down Expand Up @@ -240,14 +245,14 @@ public:
return removeList(list, true);
}

/// Removes all of the elements of this collection that satisfy the given predicate.
// / Removes all of the elements of this collection that satisfy the given predicate.
//bool removeIf(Predicate<? super E> filter)

/// Removes from this list all of the elements whose index is between fromIndex,
/// inclusive, and toIndex, exclusive.
// / Removes from this list all of the elements whose index is between fromIndex,
// / inclusive, and toIndex, exclusive.
//protected void removeRange(int fromIndex, int toIndex)

/// Replaces each element of this list with the result of applying the operator to that element.
// / Replaces each element of this list with the result of applying the operator to that element.
//void replaceAll(UnaryOperator<E> operator)

/// Returns the number of elements in this list.
Expand All @@ -256,9 +261,10 @@ public:
return ArraySize(elements);
}

/// Sorts this list according to the order induced by the specified Comparator.
// / Sorts this list according to the order induced by the specified Comparator.
//void sort(Comparator<? super E> c)

/// @see https://www.mql5.com/en/docs/array/arraycopy
int subList(Type &dst_array[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY)
{
return ArrayCopy(dst_array, elements, dst_start, src_start, count);
Expand Down
22 changes: 15 additions & 7 deletions Include/Roffild/ArrayListClass.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
* https://github.com/Roffild/RoffildLibrary
*/

/// ArrayList from Java for Class only
template<typename Type>
class CArrayListClass
{
protected:
Type *elements[];
int reserve;
bool useDelete;
bool useDelete; ///< Use delete() when cleaning?

// Всё, что требует сравнение классов мне сейчас не нужно...
//bool removeList(const Type *&list[], bool saveOnlyList = false)
Expand Down Expand Up @@ -49,10 +50,12 @@ public:
reserve = _reserve;
}

/// Use delete() when cleaning?
bool getUseDelete()
{
return useDelete;
}
/// Use delete() when cleaning?
void setUseDelete(bool _useDelete)
{
useDelete = _useDelete;
Expand Down Expand Up @@ -89,6 +92,7 @@ public:
{
return addAll(ArraySize(elements), list);
}
/// Appends all of the elements in the specified collection to the end of this list.
bool addAll(const CArrayListClass<Type> &list)
{
return addAll(ArraySize(elements), list);
Expand All @@ -114,6 +118,8 @@ public:
}
return false;
}
/// Inserts all of the elements in the specified collection into this list,
/// starting at the specified position.
bool addAll(int index, const CArrayListClass<Type> &list)
{
return addAll(index, list.elements);
Expand All @@ -130,23 +136,24 @@ public:
ArrayResize(elements, 0, reserve);
}

/// Returns a shallow copy of this ArrayList instance.
// / Returns a shallow copy of this ArrayList instance.
//Object clone()

/// Increases the capacity of this ArrayList instance, if necessary,
/// to ensure that it can hold at least the number of elements
/// specified by the minimum capacity argument.
// / Increases the capacity of this ArrayList instance, if necessary,
// / to ensure that it can hold at least the number of elements
// / specified by the minimum capacity argument.
//void ensureCapacity(int minCapacity)

/// Performs the given action for each element of the Iterable until all elements
/// have been processed or the action throws an exception.
// / Performs the given action for each element of the Iterable until all elements
// / have been processed or the action throws an exception.
//void forEach(Consumer<? super E> action)

/// Returns the element at the specified position in this list.
Type* get(int index)
{
return elements[index];
}
/// Returns the element at the specified position in this list.
Type* operator[](int index)
{
return get(index);
Expand Down Expand Up @@ -189,6 +196,7 @@ public:
return ArraySize(elements);
}

/// @see https://www.mql5.com/en/docs/array/arraycopy
int subList(Type *&dst_array[], int dst_start = 0, int src_start = 0, int count = WHOLE_ARRAY)
{
return ArrayCopy(dst_array, elements, dst_start, src_start, count);
Expand Down
4 changes: 4 additions & 0 deletions Include/Roffild/CsvFile.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/
#include "SqlFile.mqh"

/**
* Write data to a file format CSV.
* TODO inherit from CSqlFile.
*/
class CCsvFile
{
protected:
Expand Down
27 changes: 27 additions & 0 deletions Include/Roffild/ForestSerializer.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@
*/
#include <Math/Alglib/dataanalysis.mqh>

/**
* Save and load data for the class CDecisionForest (Alglib).
*/
class CForestSerializer
{
public:
/**
* Save to the text format Alglib (very slow).
*/
static void toText(CDecisionForest &forest, int hfile)
{
CSerializer ser;
Expand All @@ -29,6 +35,9 @@ public:
FileWrite(hfile, ser.Get_String());
}

/**
* Save to the text format Alglib (very slow).
*/
static bool toText(CDecisionForest &forest, const string filename, const bool common = true)
{
int hfile = FileOpen(filename, FILE_TXT|FILE_WRITE|(common ? FILE_COMMON : 0));
Expand All @@ -40,6 +49,9 @@ public:
return true;
}

/**
* Load from the text format Alglib (very slow).
*/
static void fromText(CDecisionForest &forest, int hfile)
{
CSerializer ser;
Expand All @@ -52,6 +64,9 @@ public:
ser.Stop();
}

/**
* Load from the text format Alglib (very slow).
*/
static bool fromText(CDecisionForest &forest, const string filename, const bool common = true)
{
int hfile = FileOpen(filename, FILE_TXT|FILE_READ|FILE_SHARE_READ|(common ? FILE_COMMON : 0));
Expand All @@ -63,6 +78,9 @@ public:
return true;
}

/**
* Save to the binary format (fast).
*/
static void toBinary(CDecisionForest &forest, int hfile)
{
FileWriteInteger(hfile, forest.m_nvars);
Expand All @@ -72,6 +90,9 @@ public:
FileWriteArray(hfile, forest.m_trees);
}

/**
* Save to the binary format (fast).
*/
static bool toBinary(CDecisionForest &forest, const string filename, const bool common = true)
{
int hfile = FileOpen(filename, FILE_BIN|FILE_WRITE|(common ? FILE_COMMON : 0));
Expand All @@ -83,6 +104,9 @@ public:
return true;
}

/**
* Load from the binary format (fast).
*/
static void fromBinary(CDecisionForest &forest, int hfile)
{
forest.m_nvars = FileReadInteger(hfile);
Expand All @@ -93,6 +117,9 @@ public:
FileReadArray(hfile, forest.m_trees, 0, forest.m_bufsize);
}

/**
* Load from the binary format (fast).
*/
static bool fromBinary(CDecisionForest &forest, const string filename, const bool common = true)
{
int hfile = FileOpen(filename, FILE_BIN|FILE_READ|FILE_SHARE_READ|(common ? FILE_COMMON : 0));
Expand Down
8 changes: 4 additions & 4 deletions Include/Roffild/Log4MQL.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected:
}

public:
/// Добавляет значение переменной к сообщению
/// Adds the value of the variable to the message
_LOG_CLASS* a(const string value)
{
if (lglvl < Log4MqlLevel) {
Expand All @@ -134,16 +134,16 @@ public:
args[count-1] = value;
return GetPointer(this);
}
/// Добавляет значение переменной к сообщению
/// Adds the value of the variable to the message
_LOG_CLASS* add(const string value)
{
return a(value);
}

/// Использовать Print() ?
/// Use Print() ?
static bool doPrint;

/// Собирает и выводит сообщение
/// Compile and display a message
/// @see http://www.slf4j.org/apidocs/org/slf4j/helpers/MessageFormatter.html
virtual string build()
{
Expand Down
6 changes: 3 additions & 3 deletions Include/Roffild/Log4MQL_tofile.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ protected:
}

public:
/// Из-за ограничения наследования этот конструктор пришлось сделать публичным,
/// но использовать его не рекомендуется.
/// Due to inheritance restriction, this class constructor had to be made public,
/// but it is not recommended to use it.
CLog4MqlFile(LOG_LEVEL lvl, const string text) : CLog4Mql(lvl, text)
{
if (hlog == INVALID_HANDLE) {
Expand Down Expand Up @@ -64,7 +64,7 @@ public:
return hlog;
}

/// Собирает и выводит сообщение
/// Compile and display a message
/// @see http://www.slf4j.org/apidocs/org/slf4j/helpers/MessageFormatter.html
virtual string build()
{
Expand Down
Loading

0 comments on commit 7cddbe3

Please sign in to comment.