Click here to Skip to main content
15,886,030 members
Articles / Desktop Programming / MFC

What's New in ACF 0.3

Rate me:
Please Sign up or sign in to vote.
3.39/5 (7 votes)
23 Jun 20043 min read 40.4K   193   8  
This article introduces what's new in ACF (Another C++ Framework) version 0.3.
// This is the main project file for VC++ application project 
// generated using an Application Wizard.

#include "stdafx.h"

using namespace Acf;

bool TestParsing(NumberStyles style, Array<StringPtr>* tests, Array<int>* results)
{
    bool ret = true;

    for (int i = 0; i < tests->Length; i++)
    {
        int n = Int32::Parse(tests->Item[i], style);

        if (n != results->Item[i])
        {
            Console::WriteLine(L"Error! {0}", tests->Item[i]);
            ret = false;
        }
    }

    return ret;
}

int _tmain()
{
    RefPtr<Array<int> > results = Array<int>::Build(
        Int32::MinValue, 
        Int32::MaxValue, 
        -1000, 
        -99, 
        -1, 
        0, 
        1, 
        99, 
        1000
        );

    //
    // Currency
    //

    RefPtr<Array<StringPtr> > currencyTests = Array<StringPtr>::Build(
        str(L"($2,147,483,648.00)"), 
        str(L"$2,147,483,647.00"), 
        str(L"($1,000.00)"), 
        str(L"($99.00)"), 
        str(L"($1.00)"), 
        str(L"$0.00"), 
        str(L"$1.00"), 
        str(L"$99.00"), 
        str(L"$1,000.00")
        );

    Console::WriteLine(L"Test Currency:");

    TestParsing(NumberStyles::Currency, currencyTests, results);

    Console::WriteLine();

    //
    // Integer
    //

    RefPtr<Array<StringPtr> > integerTests = Array<StringPtr>::Build(
        str(L"-2147483648"), 
        str(L"2147483647"), 
        str(L"-1000"), 
        str(L"-99"), 
        str(L"-1"), 
        str(L"0"), 
        str(L"1"), 
        str(L"99"), 
        str(L"1000")
        );

    Console::WriteLine(L"Test Integer:");

    TestParsing(NumberStyles::Integer, integerTests, results);

    Console::WriteLine();

    //
    //  Number
    //

    RefPtr<Array<StringPtr> > numberTests = Array<StringPtr>::Build(
        str(L"-2,147,483,648.00"), 
        str(L"2,147,483,647.00"), 
        str(L"-1,000.00"), 
        str(L"-99.00"), 
        str(L"-1.00"), 
        str(L"0.00"), 
        str(L"1.00"), 
        str(L"99.00"), 
        str(L"1,000.00")
        );

    Console::WriteLine(L"Test Number:");

    TestParsing(NumberStyles::Number, numberTests, results);

    Console::WriteLine();

    //
    // HexNumber
    //

    RefPtr<Array<StringPtr> > hexadecimalTests = Array<StringPtr>::Build(
        str(L"80000000"), 
        str(L"7FFFFFFF"), 
        str(L"FFFFFC18"), 
        str(L"FFFFFF9D"), 
        str(L"FFFFFFFF"), 
        str(L"0"), 
        str(L"1"), 
        str(L"63"), 
        str(L"3E8")
        );

    Console::WriteLine(L"Test HexNumber:");

    TestParsing(NumberStyles::HexNumber, hexadecimalTests, results);

    Console::WriteLine();

	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
China China
Yingle Jia is a software engineer located in Beijing, China. He currently works at IBM CSDL (China Software Development Lab). His interests include C++/COM/C#/.NET/XML, etc. He likes coding and writing.

He is the creator of ACF (Another C++ Framework) project. See http://acfproj.sourceforge.net/.

He also has a blog at http://blogs.wwwcoder.com/yljia/

Comments and Discussions