// ************************************************************************************************************
// Author: Marcin Załęczny
// Release Date: 2010-11-08
// Licence: The GNU Lesser General Public License, version 3.0 (LGPLv3)
// ************************************************************************************************************
#include "mzstdxpsCommon.h"
#include "mzstdxpsGlobals.h"


VOID WINAPI initMzstdxpsLibrary() {
}

VOID WINAPI cleanupMzstdxpsLibrary() {
}




#ifdef MZSTDXPS_INTERNAL
CString WINAPI XpsFloatToString(float x) {
    CString retval(x);
    
    while (retval.endsWithChar(L'0')) {
        retval.truncateAtEnd(1);
    }
    if (retval.endsWithChar(L'.') || retval.endsWithChar(L',')) {
        retval.truncateAtEnd(1);
    }
    retval.replace(L',', L'.');
    if (retval == L"-0") {
        retval = L"0";
    }
    return retval;
}

CString WINAPI XpsPointToString(float x, float y) {
    CString v(x);
    CString retval;
    
    while (v.endsWithChar(L'0')) {
        v.truncateAtEnd(1);
    }
    if (v.endsWithChar(L'.') || v.endsWithChar(L',')) {
        v.truncateAtEnd(1);
    }
    v.replace(L',', L'.');
    retval = v;
    
    v = y;    
    while (v.endsWithChar(L'0')) {
        v.truncateAtEnd(1);
    }
    
    if (v.endsWithChar(L'.') || v.endsWithChar(L',')) {
        v.truncateAtEnd(1);
    }
    v.replace(L',', L'.');
    retval = retval + L"," + v;
    
    return retval;
}
#endif // MZSTDXPS_INTERNAL