This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
141 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Created by Romain on 10/09/2020. | ||
|
||
#include "stringClass.hpp" | ||
#include "stringC.hpp" | ||
|
||
string::string(const char* s) { | ||
this->_s = s; | ||
this->_length = stdstring::strlen(s); | ||
} | ||
|
||
u32 string::length() const { | ||
return this->_length; | ||
} | ||
|
||
const char* string::toChar() const { | ||
return this->_s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Created by Romain on 07/11/2020. | ||
|
||
#ifndef ROMAINOS_STRINGCLASS_HPP | ||
#define ROMAINOS_STRINGCLASS_HPP | ||
|
||
#include <stdint.h> | ||
|
||
/** | ||
* String | ||
*/ | ||
class string { | ||
public: | ||
string() = delete; | ||
|
||
/** | ||
* Constructeur | ||
* | ||
* @param s Chaine | ||
*/ | ||
explicit string(const char* s); | ||
|
||
/** | ||
* Destructeur | ||
*/ | ||
~string() = default; | ||
|
||
/** | ||
* Taille | ||
* | ||
* @return Taille | ||
*/ | ||
[[nodiscard]] u32 length() const; | ||
|
||
/** | ||
* To char* | ||
* | ||
* @return Pointeur | ||
*/ | ||
[[nodiscard]] const char* toChar() const; | ||
|
||
private: | ||
/** | ||
* Chaine | ||
*/ | ||
const char* _s; | ||
|
||
/** | ||
* Taille | ||
*/ | ||
u32 _length; | ||
}; | ||
|
||
#endif //ROMAINOS_STRINGCLASS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Created by Romain on 07/11/2020. | ||
|
||
#ifndef ROMAINOS_STRINGROMAINOS_HPP | ||
#define ROMAINOS_STRINGROMAINOS_HPP | ||
|
||
/** | ||
* Hex to String | ||
* | ||
* @tparam T Type | ||
* @param value Valeur | ||
* | ||
* @return Hex | ||
*/ | ||
template<typename T> | ||
const char* hexToString(T value); | ||
|
||
/** | ||
* Int vers string | ||
* | ||
* @tparam T Type | ||
* @param value Int | ||
* | ||
* @return String de l'int | ||
*/ | ||
template<typename T> | ||
const char* intToString(T value); | ||
|
||
/** | ||
* Hack pour utiliser intToString sur des pointeurs. | ||
* Le <code>value *= -1;</code> ne passe en effet pas pour des pointeurs. | ||
* | ||
* @tparam T Type | ||
* @param value Int* | ||
* | ||
* @return String de l'int | ||
*/ | ||
template<typename T> | ||
const char* intToString(T* value); | ||
|
||
/** | ||
* Float to string | ||
* | ||
* @tparam T Type | ||
* @param value Value | ||
* @param decimalPlaces Nb de décimales | ||
* | ||
* @return String de float | ||
*/ | ||
template <typename T> | ||
const char* floatToString(T value, u8 decimalPlaces = 3); | ||
|
||
#include "../string/stringRomainOS.tpp" | ||
|
||
#endif //ROMAINOS_STRINGROMAINOS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters