GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  A2X (3)

NAME

FBB::A2x - Objects performing ascii-to-x (anything) conversions

CONTENTS

SYNOPSIS

#include <bobcat/a2x>
Linking option: -lbobcat

DESCRIPTION

FBB::A2x objects offer the C++ equivalent of the standard C conversion functions atoi(3), atol(3), atof(3) etc. A2x objects generalize these C functions to any type that can be extracted from an istream object. Since FBB::A2x represents the object-variant of the C functions, and is therefore type-safe and extensible, their use is greatly preferred over using the standard C functions.

NAMESPACE

FBB
All constructors, members, and operators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

std::istringstream

CONSTRUCTORS

o A2x():
This constructor constructs an empty A2x object. No information can be converted from a thus constructed A2x object.
o A2x(char const *text):
This constructor stores text. If text represents a textual value of some type, the A2x object may be used to initialize or assign this value to a variable of that particular type. Extraction, however is also still possible.
o A2x(std::string const &str):
This constructor stores the text contained in str. If this text represents a textual value of some type, the A2x object may be used to initialize or assign this value to a variable of that particular type. Extraction is also still possible. The copy constructor is available.

STATIC MEMBER FUNCTION

o bool lastFail():
This member returns true if the last conversion failed (i.e., the object\(cqs fail() member returned true and returns false otherwise). This member allows checks on the success of the extraction/conversion using anonymous A2x objects. The member also returns true when no conversions have as yet been performed.
Note that this member is a thread-unsafe static member: in a multithreaded program locks may be required to ensure that the proper conversion result is inspected.

MEMBER FUNCTION

All members of the istringstream class are available.

o Type to():
This member returns any type Type supporting extractions from i[string]streams. If the extraction fails, the A2x object\(cqs good() member will return false, and the Type\(cqs default value is returned. This operator was implemented as a template member function. There is also a type conversion operator available (see below), but the member function variant may be preferred over the conversion operator in situations where explicit disambiguation is required (e.g., in cases where a conversion has no obvious type solution such as direct insertions) An example is provided in the EXAMPLE section below.

OVERLOADED OPERATORS

o operator Type():
Conversion to any type Type supporting extractions from i[string]streams. If the extraction fails, the A2x object\(cqs good() member will return false, and the Type\(cqs default value is returned. This operator was implemented as a template member function.
o istream &operator>>(istream &, Type &):
Extraction to any type Type supporting extractions from i[string]streams. If the extraction fails, the A2x object\(cqs good() member will return false, and the Type\(cqs default value is returned (this facility is implied by the fact that this class inherits from istringstream, but it\(cqs probably useful to stress that the extraction operation is still available).
o A2x &operator=(char const *):
Stores new text in the A2x object, resets the status flags to ios::good. If a 0-pointer is passed, an empty string is stored.
o A2x &operator=(std::string const &):
Stores the text stored in the std::string argument in the A2x object, resets the status flags to ios::good.
o A2x &operator=(A2x const &):
The standard overloaded assignment operator is available

EXAMPLE

int x = A2x(\(dq12\(dq);

A2x a2x(\(dq12.50\(dq);

double d;

d = a2x;

a2x = \(dqerr\(dq;

d = a2x; // d now 0

a2x = \(dq a\(dq;

char c = a2x; // c now \(cqa\(cq

// explicit conversion to ‘double\(cq cout << A2x(\(dq12.4\(dq).to<double>() << endl;

FILES

bobcat/a2x - defines the class interface

SEE ALSO

bobcat(7), x2a(3bobcat), atoi(3), atol(3), atof(3), strtod(3), strtol(3), strdoul(3)

BUGS

None Reported.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::A2X (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.