Reader small image

You're reading from  C++ Windows Programming

Product typeBook
Published inSep 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781786464224
Edition1st Edition
Languages
Right arrow
Author (1)
Stefan Björnander
Stefan Björnander
author image
Stefan Björnander

Stefan Björnander is the author of the books Microsoft Windows C++ and C++ Windows Programming. He holds a Master of Engineering and a Licentiate in Computer Science. He has worked as a software developer and as a teacher in computer science and mathematics for many years.
Read more about Stefan Björnander

Right arrow

Converters


The Converter class is a template class intended to be specialized by type. Its task is to convert values between the template type and the String objects. The Check variable takes a string and returns true if it holds a valid value, TextToValue converts a text to a value, and ValueToText converts a value to a text.

Converter.h

namespace SmallWindows { 
  template <class Type> 
  class Converter { 
    public: 
      static bool Check(String& text, int base); 
      static Type TextToValue(String& text, int base); 
      static String ValueToText(Type& value, int base); 
  }; 

Signed integers

Small Windows comes equipped with a set of predefined converters, which are specializations of Converter. One of these handles signed integer values of the type int.

Converter.h

  template <> 
  class Converter<int> { 
    public: 
      static bool Check(String& text, int base); 
      static int...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
C++ Windows Programming
Published in: Sep 2016Publisher: PacktISBN-13: 9781786464224

Author (1)

author image
Stefan Björnander

Stefan Björnander is the author of the books Microsoft Windows C++ and C++ Windows Programming. He holds a Master of Engineering and a Licentiate in Computer Science. He has worked as a software developer and as a teacher in computer science and mathematics for many years.
Read more about Stefan Björnander