Skip to content

Commit

Permalink
Updates documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
psde committed Jan 16, 2013
1 parent 75dae19 commit ade6ac8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 52 deletions.
5 changes: 1 addition & 4 deletions src/BufferReader.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef BUFFER_HPP
#define BUFFER_HPP
#pragma once

#include <iostream>
#include <stdlib.h>
Expand Down Expand Up @@ -99,5 +98,3 @@ class BufferReader
}

};

#endif
5 changes: 1 addition & 4 deletions src/BufferWriter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef BUFFERWRITER_HPP
#define BUFFERWRITER_HPP
#pragma once

#include <errno.h>
#include <iostream>
Expand Down Expand Up @@ -103,5 +102,3 @@ class BufferWriter
this->bufferPosition = 0;
}
};

#endif
80 changes: 40 additions & 40 deletions src/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class String
char* chars;

/*
Returns the length of a char array
*/
* Returns the length of a char array
*/
unsigned int stringLength(char const *string)
{
unsigned int length;
Expand All @@ -28,51 +28,51 @@ class String

public:
/*
Constructor with no arguments
*/
* Constructor with no arguments
*/
String()
{
this->chars = new char[1];
this->chars[0] = '\0';
}

/*
Constructor with passed char array
*/
* Constructor with passed char array
*/
String(char const *s)
{
this->chars = new char[stringLength(s) + 1];
strcpy(this->chars, s);
}

/*
Constructor with passed string object
*/
* Constructor with passed string object
*/
String(String const &stringObj)
{
this->chars = new char[stringLength(stringObj.chars) + 1];
strcpy(this->chars, stringObj.chars);
}

/*
Deconstructor
*/
* Deconstructor
*/
~String()
{
delete[] this->chars;
}

/*
Returns interpreted long
*/
* Returns interpreted long
*/
long toLong()
{
return strtol(this->chars, NULL, 10);
}

/*
Returns interpreted unsigned long
*/
* Returns interpreted unsigned long
*/
unsigned long toULong()
{
unsigned long l = strtoul(this->chars, NULL, 10);
Expand All @@ -85,8 +85,8 @@ class String
}

/*
Returns the string length
*/
* Returns the string length
*/
unsigned int length()
{
//return stringLength(this.chars);
Expand All @@ -100,16 +100,16 @@ class String
}

/*
Returns the char at a passed index
*/
* Returns the char at a passed index
*/
char& operator[](int index)
{
return this->chars[index];
}

/*
Sets the string to a passed string object
*/
* Sets the string to a passed string object
*/
void operator=(String const& s)
{
delete[] this->chars;
Expand All @@ -118,8 +118,8 @@ class String
}

/*
Concat with char*
*/
* Concat with char*
*/
String operator+(const char *c1)
{
String str(this->chars);
Expand All @@ -129,8 +129,8 @@ class String
}

/*
Concat with String
*/
* Concat with String
*/
String operator+(const String &s)
{
String str(this->chars);
Expand All @@ -139,8 +139,8 @@ class String
}

/*
Appends an int
*/
* Appends an int
*/
void operator+=(int const& l)
{
char buf[sizeof(int)*8+1];
Expand All @@ -162,8 +162,8 @@ class String
}

/*
Appends a long
*/
* Appends a long
*/
void operator+=(long const& l)
{
char buf[sizeof(long)*8+1];
Expand All @@ -186,8 +186,8 @@ class String


/*
Appends a char
*/
* Appends a char
*/
void operator+=(char const& c)
{
unsigned int length = stringLength(this->chars) + 2;
Expand All @@ -202,8 +202,8 @@ class String
}

/*
Appends a string
*/
* Appends a string
*/
void operator+=(String const& s)
{
char* newChars = new char[stringLength(s.chars) + stringLength(this->chars) + 1];
Expand All @@ -216,8 +216,8 @@ class String
}

/*
Checks for equality
*/
* Checks for equality
*/
bool operator==(String const& s)
{
if(this->length() != stringLength(s.chars))
Expand All @@ -232,16 +232,16 @@ class String
}

/*
Checks for inequality
*/
* Checks for inequality
*/
bool operator!=(String const& s)
{
return !(*this == s);
}

/*
<< blah
*/
* << blah
*/
friend std::ostream& operator<<(std::ostream& os, String const& str)
{
os << str.chars;
Expand All @@ -250,8 +250,8 @@ class String


/*
Wtf... at least this is const..
*/
* Wtf... at least this is const..
*/
const char* getChars()

{
Expand Down
5 changes: 1 addition & 4 deletions src/Vector.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef _VECTOR_INCLUDED_
#define _VECTOR_INCLUDED_
#pragma once

/* Simple vector implementation */
template <class type>
Expand Down Expand Up @@ -88,5 +87,3 @@ class Vector {
return this->size;
}
};

#endif // _VECTOR_INCLUDED_

0 comments on commit ade6ac8

Please sign in to comment.