*/
static std::string asString(const unsigned int number) throw();
- /**
- \param number Numero a convertir.
- @return Un literal con el numero sin signo convertido a cadena decimal.
- */
- static std::string asString(const unsigned long long int number) throw() {
- return asString((U64)number);
- }
-
- /**
- \param number Numero a convertir.
- @return Un literal con el numero sin signo convertido a cadena decimal.
- */
- static std::string asString(const long long int number) throw() {
- return asString((S64)number);
- }
-
/**
Devuelve un literal con tel numero convertido a cadena decimal
@return Un literal con el numero signo convertido a cadena decimal.
// Note that CLOCK_MONOTONIC is subject to discontinuities from system time
// adjustment in Linux. CLOCK_MONOTONIC_RAW was defined to get around this
// (gets hardware time not adjusted by NTP).
- clock_gettime(CLOCK_MONOTONIC_RAW, &ts); // works
+ clock_gettime(CLOCK_MONOTONIC, &ts); // works
Microsecond result((Microsecond::type_t)1000000 * ts.tv_sec + ts.tv_nsec / 1000);
return result;
* @param target Isup number octet string.
*/
static void codeIsupNumber(const isup_number_t & isupNumber, bool calledOrCalling, std::string & target) throw(RuntimeException);
+
+ /**
+ * Base64 encoding
+ *
+ * @param str String to be encoded
+ *
+ * @return Returns encoded representation
+ */
+ static std::string encodeBase64(const U8* buf, unsigned int bufLen);
+ static std::string encodeBase64(const std::string & str)
+ {
+ return encodeBase64((const U8 *)str.c_str(), str.size());
+ }
+
+ /**
+ * Base64 decoding
+ *
+ * @param encodedString Encoded base64 representation
+ *
+ * @return Returns decoded representation
+ */
+ static std::string decodeBase64(const std::string & encodedString);
+
+
+ /*
+ * Reads a file into passed string
+ *
+ * @param pathfile Path file to read
+ * @param content String where file content is dump
+ *
+ * @return success for read operation
+ */
+ static bool getContentFromFile(const std::string &pathfile, std::string &content) throw(anna::RuntimeException);
};
}