J
Joe C
I'm in the process of trying to convert/recompile an existing C++
program, written in 1995, to compile and link in a Sun Solaris 8
environment using the C++ compiler that comes with Sun One Studio.
The old code uses the OMANIP macro that is not supported in the new
environment. The functionality of the class is to initialize an
ostream buffer and use manipulators to fill in portions of the buffer.
So for example I may have an ostream called mylabel. mylabel would be
initialized with "Name: City: State: Zip:
".
By invoking :
mylabel << Name("John Doe") << City("Austin") << State("Texas") <<
Zip("11111") the following output would be produced:
Name: John Doe City: Austin State: Texas Zip: 11111
Using the OMANIP macro the code looked like
mylabel::mylabel
{
.... (initialize buffer - my_LogBuffer) ...
OMANIP(std_string)
mylabel::Name(std_string name)
{
return OMANIP(std_string)(DoName, name);
}
ostream &
mylabel:oName(ostream & o, std_string name)
{
((my_LogBuffer*)o.rdbuf())->m_name = name;
return o;
}
similar methods for City State and Zip
}
I looked at defining the operator << in this class, but I need to be
able to call different methods to change the buffer for a Name , City
etc. Thanks for any help.
program, written in 1995, to compile and link in a Sun Solaris 8
environment using the C++ compiler that comes with Sun One Studio.
The old code uses the OMANIP macro that is not supported in the new
environment. The functionality of the class is to initialize an
ostream buffer and use manipulators to fill in portions of the buffer.
So for example I may have an ostream called mylabel. mylabel would be
initialized with "Name: City: State: Zip:
".
By invoking :
mylabel << Name("John Doe") << City("Austin") << State("Texas") <<
Zip("11111") the following output would be produced:
Name: John Doe City: Austin State: Texas Zip: 11111
Using the OMANIP macro the code looked like
mylabel::mylabel
{
.... (initialize buffer - my_LogBuffer) ...
OMANIP(std_string)
mylabel::Name(std_string name)
{
return OMANIP(std_string)(DoName, name);
}
ostream &
mylabel:oName(ostream & o, std_string name)
{
((my_LogBuffer*)o.rdbuf())->m_name = name;
return o;
}
similar methods for City State and Zip
}
I looked at defining the operator << in this class, but I need to be
able to call different methods to change the buffer for a Name , City
etc. Thanks for any help.