473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

converting from OMANIP

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::DoName(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.
Jul 19 '05 #1
1 1873
"Joe C" <jo***********@eds.com> wrote in message
news:6a**************************@posting.google.c om...
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

[....]

If you would like to preserve your existing code as is, the best
might be to get a peek at the original implementation of the macro...

But you may want to consider changing your code and base it
on another free library. I would suggest one from boost:
http://www.boost.org/libs/format/index.htm

Boost is a popular collection of peer-reviewed C++ libraries,
designed to be candidates for inclusion in a future standard.
(and there are several successful examples...)
I hope this helps,
Ivan
--
http://ivan.vecerina.com

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mustafa | last post by:
Dear sir , I have built my application in visual basic 6.0 and crystal Report8.5 , Now i migrated my application to VB.net using the upgrade wizard.My visual basic form is upgraded to vb.net...
2
by: David Williams | last post by:
Hi, I am having some difficulties compiling a library written by someone else, and was hoping someone could indicate what's wrong! I have cut the code down to what I believe to be the relevant...
29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
by: Mary | last post by:
Hi, Does anyone know of any software out there that would convert an application written in VBScript to either VB.NET or C#/C++ quite quickly for me, or will I have to re-write the application...
2
by: Map Reader | last post by:
Greetings, I am converting an old VB6 application to use .NET. One of the old controls loads icons from the disk and displays them. However, the transparent color turns to blue somewhere in the...
7
by: Tor Aadnevik | last post by:
Hi, I have a problem converting values from Single to double. eg. When the Single value 12.19 is converted to double, the result is 12.1899995803833. Anyone know how to avoid this? Regards...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.