Common header files in the Secure Login example

connections.h

#pragma once

namespace connections {

constexpr const char *ConnectionName = "authservice";

constexpr const char *LoginConnectionPoint = "auth_service.AuthService.login";

constexpr const char *ResultConnectionPoint = "auth_service.AuthService.result";

} // namespace connections

formatter.h

#pragma once

#include <sstream>

#include <string>

class Formatter

{

public:

Formatter()

{}

virtual ~Formatter() = default;

template <typename Type>

Formatter &operator<<(const Type &value)

{

m_stream << value;

return *this;

}

std::string str() const

{

return m_stream.str();

}

operator std::string() const

{

return m_stream.str();

}

enum ConvertToString

{

toStr

};

std::string operator>>(ConvertToString)

{

return m_stream.str();

}

private:

Formatter(const Formatter &);

Formatter &operator=(Formatter &);

private:

std::stringstream m_stream;

};

Page top