X-Git-Url: https://git.llucax.com/z.facultad/75.42/string.git/blobdiff_plain/91ae14ba4499be590813ab84a75f5c027ac12c11..8ea54871577c6d32ef579c1587dfd4eda3f36ddf:/unicode.cpp?ds=inline diff --git a/unicode.cpp b/unicode.cpp index f1a0ad7..c0bfa8f 100644 --- a/unicode.cpp +++ b/unicode.cpp @@ -20,7 +20,7 @@ # include #endif -Unicode::Unicode(short c = 0): caracter(c) { +Unicode::Unicode(short c): caracter(c) { #ifdef DEBUG std::cerr << "En constructor de Unicode." << std::endl; #endif @@ -60,14 +60,20 @@ bool Unicode::operator==(const Unicode& unicode) { return caracter == unicode.caracter; } -char Unicode::operator char(void) { +Unicode::operator short(void) const { +#ifdef DEBUG + std::cerr << "En cast de Unicode a char." << std::endl; +#endif + return static_cast(caracter); +} + +Unicode::operator char(void) const { #ifdef DEBUG std::cerr << "En cast de Unicode a char." << std::endl; #endif return static_cast(caracter); } -/// Volcado a un stream de salida. std::ostream& operator<<(std::ostream& out, const Unicode& unicode) { #ifdef DEBUG std::cerr << "En operator<< de Unicode." << std::endl; @@ -75,7 +81,6 @@ std::ostream& operator<<(std::ostream& out, const Unicode& unicode) { return out << unicode.caracter; } -/// Captura desde un stream de entrada. std::istream& operator>>(std::istream& in, const Unicode& unicode) { #ifdef DEBUG std::cerr << "En operator>> de Unicode." << std::endl;