Skip to content

Commit

Permalink
addressing android/ndk#379
Browse files Browse the repository at this point in the history
  • Loading branch information
PierceLBrooks committed Apr 7, 2019
1 parent d21943a commit 2680122
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 50 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=c++14")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=c++11 -fno-exceptions")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -std=c++11 -fno-exceptions")

project("IDCP")

Expand Down
5 changes: 4 additions & 1 deletion inc/Bpm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <string>
#include <regex>

namespace idc::parser
namespace idc
{
namespace parser
{
class Bpm
{
Expand All @@ -22,5 +24,6 @@ namespace idc::parser
std::string to_string() const;
};
}
}

#endif
5 changes: 4 additions & 1 deletion inc/Note.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <string>
#include <regex>

namespace idc::parser
namespace idc
{
namespace parser
{
class Note
{
Expand Down Expand Up @@ -52,5 +54,6 @@ namespace idc::parser
std::string to_string() const;
};
}
}

#endif
5 changes: 4 additions & 1 deletion inc/Song.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <vector>
#include <sstream>

namespace idc::parser
namespace idc
{
namespace parser
{
class Song
{
Expand Down Expand Up @@ -57,5 +59,6 @@ namespace idc::parser
std::string to_string() const;
};
}
}

#endif
5 changes: 4 additions & 1 deletion inc/Sud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <string>
#include <regex>

namespace idc::parser
namespace idc
{
namespace parser
{
class Sud
{
Expand All @@ -22,5 +24,6 @@ namespace idc::parser
std::string to_string() const;
};
}
}

#endif
26 changes: 11 additions & 15 deletions src/Bpm.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Bpm.hpp"
#include <sstream>

namespace idc::parser
namespace idc
{
namespace parser
{
Bpm::Bpm() :
val(-1.0f)
Expand All @@ -22,20 +24,13 @@ namespace idc::parser
{
//std::cerr << m[0] << " '" << m[1] << "' '" << m[2] << "' '" << m[3] << "' '"<< m[4] << "' '" << m[5] << "'" << std::endl;

try
{
this->val =
(m[5] != "")
? std::stof(m[5])
: (m[2] != "")
? std::stof(m[2])
: std::stof(m[1]);
return true;
}
catch (...)
{
return false;
}
this->val =
(m[5] != "")
? std::stof(m[5])
: (m[2] != "")
? std::stof(m[2])
: std::stof(m[1]);
return true;
}

return false;
Expand All @@ -54,4 +49,5 @@ namespace idc::parser

return ss.str();
}
}
}
20 changes: 8 additions & 12 deletions src/Note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <sstream>
#include <iostream>

namespace idc::parser
namespace idc
{
namespace parser
{
unsigned int Note::numNotes = 0;

Expand Down Expand Up @@ -76,17 +78,10 @@ namespace idc::parser
this->place = 0.0f;
else if (this->place != 0.0f)
{
try
{
this->place = std::stof(m[6]);

if (m[7] != "")
this->place /= std::stof(m[7]);
}
catch(...)
{
return false;
}
this->place = std::stof(m[6]);

if (m[7] != "")
this->place /= std::stof(m[7]);
}

return true;
Expand Down Expand Up @@ -118,4 +113,5 @@ namespace idc::parser

return ss.str();
};
}
}
5 changes: 4 additions & 1 deletion src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <cmath>
#include <iostream>

namespace idc::parser
namespace idc
{
namespace parser
{
Song::Song() :
bpm(),
Expand Down Expand Up @@ -151,4 +153,5 @@ namespace idc::parser
}


}
}
26 changes: 11 additions & 15 deletions src/Sud.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "Sud.hpp"
#include <sstream>

namespace idc::parser
namespace idc
{
namespace parser
{
Sud::Sud() :
val(-1.0f)
Expand All @@ -22,20 +24,13 @@ namespace idc::parser
{
//std::cerr << m[0] << " '" << m[1] << "' '" << m[2] << "' '" << m[3] << "' '"<< m[4] << "' '" << m[5] << "'" << std::endl;

try
{
this->val =
(m[5] != "")
? std::stof(m[5])
: (m[2] != "")
? std::stof(m[2])
: std::stof(m[1]);
return true;
}
catch (...)
{
return false;
}
this->val =
(m[5] != "")
? std::stof(m[5])
: (m[2] != "")
? std::stof(m[2])
: std::stof(m[1]);
return true;
}

return false;
Expand All @@ -54,4 +49,5 @@ namespace idc::parser

return ss.str();
}
}
}

0 comments on commit 2680122

Please sign in to comment.