Skip to content

Commit

Permalink
Merge pull request #206 from KazDragon/string-size#204
Browse files Browse the repository at this point in the history
Updated string to use size_type consistently.
  • Loading branch information
KazDragon authored Aug 26, 2019
2 parents 2495326 + 7b600a2 commit 55459a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions include/terminalpp/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public :
/// Results in a string of length len with the passed text, with all
/// attributes their default values.
//* =====================================================================
string(char const *text, std::size_t len);
string(char const *text, size_type len);

//* =====================================================================
/// \brief Constructor
Expand All @@ -87,12 +87,12 @@ public :
/// \param size the size of the string to construct.
/// \param elem a prototype element to fill the string with
//* =====================================================================
string(std::size_t size, terminalpp::element const &elem);
string(size_type size, terminalpp::element const &elem);

//* =====================================================================
/// \brief Returns the number of elements in the string.
//* =====================================================================
std::size_t size() const;
size_type size() const;

//* =====================================================================
/// \brief Returns an iterator to the beginning of the string.
Expand Down Expand Up @@ -243,14 +243,14 @@ inline namespace literals { inline namespace string_literals {
TERMINALPP_EXPORT
::terminalpp::string operator ""_ts(
char const *text,
std::size_t length);
::terminalpp::string::size_type length);

//* =========================================================================
/// \brief Construct an encoded string from literals using "foo"_ets;
//* =========================================================================
TERMINALPP_EXPORT
::terminalpp::string operator ""_ets(
char const *text,
std::size_t length);
::terminalpp::string::size_type length);

}}}
16 changes: 8 additions & 8 deletions src/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ string::string(char const* text)
// ==========================================================================
// CONSTRUCTOR
// ==========================================================================
string::string(char const* text, std::size_t len)
string::string(char const* text, size_type len)
: elements_(text, text + len)
{
}
Expand All @@ -42,7 +42,7 @@ string::string(std::string const &text)
// ==========================================================================
// CONSTRUCTOR
// ==========================================================================
string::string(std::string const &text, terminalpp::attribute const &attr)
string::string(std::string const &text, attribute const &attr)
: string(text)
{
std::for_each(elements_.begin(), elements_.end(),
Expand All @@ -55,15 +55,15 @@ string::string(std::string const &text, terminalpp::attribute const &attr)
// ==========================================================================
// CONSTRUCTOR
// ==========================================================================
string::string(std::size_t size, terminalpp::element const &elem)
string::string(size_type size, element const &elem)
: elements_(size, elem)
{
}

// ==========================================================================
// SIZE
// ==========================================================================
std::size_t string::size() const
string::size_type string::size() const
{
return elements_.size();
}
Expand Down Expand Up @@ -271,17 +271,17 @@ inline namespace literals { inline namespace string_literals {
// ==========================================================================
// OPERATOR""_ts
// ==========================================================================
terminalpp::string operator ""_ts(char const *text, std::size_t len)
string operator ""_ts(char const *text, string::size_type len)
{
return terminalpp::string(text, len);
return string(text, len);
}

// ==========================================================================
// OPERATOR""_ets
// ==========================================================================
terminalpp::string operator ""_ets(char const *text, std::size_t len)
string operator ""_ets(char const *text, string::size_type len)
{
return terminalpp::encode(text, len);
return encode(text, len);
}

}}}

0 comments on commit 55459a0

Please sign in to comment.