/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_SERVER_ATTRMANIP_H
#define TANGO_SERVER_ATTRMANIP_H

#include <algorithm>
#include <ostream>
#include <string>

namespace Tango
{

class AttrManip
{
    friend std::ostream &operator<<(std::ostream &, const AttrManip &);
    friend void execute_manip(std::ostream &, const std::string &str);

  public:
    AttrManip(const char *f) :
        format(f)
    {
        std::transform(format.begin(), format.end(), format.begin(), ::tolower);
    }

    AttrManip(const std::string &str) :
        format(str)
    {
        std::transform(format.begin(), format.end(), format.begin(), ::tolower);
    }

    const std::string &to_string() const
    {
        return format;
    }

  private:
    std::string format;
};

} // namespace Tango

#endif
