Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Setup CMake to build for macOS
[xestiaab/.git] / source / tools / bitmapcode.cpp
index 222d2dc..4425062 100644 (file)
@@ -1,22 +1,30 @@
-//-------------------------------------------------------------------
-// bitmapcode: Helper application which coverts PNG files into
-// C++ code outputting binary code.
+// bitmapcode.cpp - Bitmap code helper.
 //
-// This application also is a simple test if the wxWidgets header 
-// files and library files are there.
+// (c) 2012-2015 Xestia Software Development.
 //
-// This file is licenced under the GNU General Public License
-// version 3 only. (GPLv3 only).
-//-------------------------------------------------------------------
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
 
 #include <iostream>
 #include <fstream>
 #include <iomanip>
 #include <ios>
+#include <string>
+
 #include <wx/wx.h>
 #include <wx/dir.h>
 #include <wx/tokenzr.h>
-#include <string.h>
 
 using namespace std;
 
@@ -92,8 +100,8 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter)
        // Setup the inclusion guard.
     
        cppfile << "#include <iostream>" << endl << endl;    
-       cppfile << "#ifndef " << outname.c_str() << "_CPP" << endl;
-       cppfile << "#define " << outname.c_str() << "_CPP" << endl << endl;
+       cppfile << "#ifndef " << outname.ToStdString() << "_CPP" << endl;
+       cppfile << "#define " << outname.ToStdString() << "_CPP" << endl << endl;
     
        outname.Clear();
        outname.Append(wxString::FromUTF8(DirFilenameOnly.c_str()));
@@ -105,7 +113,7 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter)
     
        // Convert the PNG file into an unsigned char array.
     
-       cppfile << "static unsigned char " << outname.c_str() <<
+       cppfile << "static unsigned char " << outname.ToStdString() <<
                "[] = {" << endl;
     
        while (pngfile){
@@ -140,10 +148,9 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter)
        cppfile << "#endif" << endl << endl;
        cppfile.close();
     
-       cout << "CPP\t" << CPPFilename.c_str() << endl;    
+       cout << "CPP\t" << CPPFilename.ToStdString() << endl;
     
        ++*counter;
-    
 }
 
 void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, 
@@ -163,7 +170,7 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist,
     
        bool fmatch = FALSE;
        wxString finaldirname;
-       wxString HPPFilename = dirfilename.c_str();
+       wxString HPPFilename = dirfilename.ToStdString();
 
        wxString DirFilenameOnly;
        wxString HPPFilenameOnly;
@@ -216,8 +223,8 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist,
 #endif
 
        hppfile << "#include <iostream>" << endl << endl;
-       hppfile << "#ifndef " << finaldirname.c_str() << "_H" << endl;
-       hppfile << "#define " << finaldirname.c_str() << "_H" << endl << endl;
+       hppfile << "#ifndef " << finaldirname.ToStdString() << "_H" << endl;
+       hppfile << "#define " << finaldirname.ToStdString() << "_H" << endl << endl;
        hppfile << "// List all CPP files in the directory." << endl << endl;
     
        // Write each CPP file into the header file.
@@ -247,8 +254,8 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist,
                CPPFileOnly.RemoveLast(4);
                CPPFileOnly.Append(wxT(".cpp"));
 
-               hppfile << "#include \"" << DirFilenameOnly.c_str() <<
-                       "/" << CPPFileOnly.c_str() << "\"" << endl;
+               hppfile << "#include \"" << DirFilenameOnly.ToStdString() <<
+                       "/" << CPPFileOnly.ToStdString() << "\"" << endl;
 
        }
     
@@ -259,7 +266,7 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist,
     
        // Increment the HPP file counter.
 
-       cout << "HPPDIR\t" << HPPFilename.c_str() << endl;
+       cout << "HPPDIR\t" << HPPFilename.ToStdString() << endl;
        ++*counter;
     
 }
@@ -378,7 +385,7 @@ int main(int argc, char *argv[])
     
        DirFilenameWxS.Empty();
 
-       std::cout << BitmapHeaderFilename.c_str() << std::endl;
+       std::cout << BitmapHeaderFilename.ToStdString() << std::endl;
 
 #if defined(__WIN32__)
 
@@ -440,7 +447,7 @@ int main(int argc, char *argv[])
                for (int fi = 0; fi < filelist.GetCount(); fi++)
                {
                
-                       CreateCPPFile(dirlist[bi].wc_str(), filelist[fi].wc_str(), &cppg);
+                       CreateCPPFile(dirlist[bi].ToStdString(), filelist[fi].ToStdString(), &cppg);
                        fp++;
                        
                }
@@ -479,12 +486,12 @@ int main(int argc, char *argv[])
 
 #elif defined(__WIN32__)
 
-               finalhppfile << "#include \"bitmaps\\" << DirNameSplit.c_str() <<
+               finalhppfile << "#include \"bitmaps\\" << DirNameSplit.ToStdString() <<
                        ".h\"" << endl;
 
 #else
 
-               finalhppfile << "#include \"bitmaps/" << DirNameSplit.c_str() <<
+               finalhppfile << "#include \"bitmaps/" << DirNameSplit.ToStdString() <<
                        ".h\"" << endl;
 
 #endif
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy