Skip to content

Commit

Permalink
Added 3rdParty submodules.
Browse files Browse the repository at this point in the history
  • Loading branch information
edisonlee0212 committed Sep 2, 2024
1 parent c761d40 commit df41e0f
Show file tree
Hide file tree
Showing 27 changed files with 2,469 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
[submodule "Extern/3rdParty/assimp/assimp"]
path = Extern/3rdParty/assimp/assimp
url = https://github.com/assimp/assimp.git
[submodule "Extern/3rdParty/base64/base64"]
path = Extern/3rdParty/base64/base64
url = https://github.com/mathiasbynens/base64.git
[submodule "Extern/3rdParty/eigen/eigen"]
path = Extern/3rdParty/eigen/eigen
url = https://github.com/libigl/eigen.git
[submodule "Extern/3rdParty/glfw/glfw"]
path = Extern/3rdParty/glfw/glfw
url = https://github.com/glfw/glfw
[submodule "Extern/3rdParty/glm/glm"]
path = Extern/3rdParty/glm/glm
url = https://github.com/g-truc/glm
[submodule "Extern/3rdParty/imgui/imgui"]
path = Extern/3rdParty/imgui/imgui
url = https://github.com/ocornut/imgui
[submodule "Extern/3rdParty/imgui/ImGuizmo"]
path = Extern/3rdParty/imgui/ImGuizmo
url = https://github.com/CedricGuillemet/ImGuizmo.git
[submodule "Extern/3rdParty/json/json"]
path = Extern/3rdParty/json/json
url = https://github.com/nlohmann/json
[submodule "Extern/3rdParty/meshoptimizer/meshoptimizer"]
path = Extern/3rdParty/meshoptimizer/meshoptimizer
url = https://github.com/zeux/meshoptimizer.git
[submodule "Extern/3rdParty/pybind11/pybind11"]
path = Extern/3rdParty/pybind11/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "Extern/3rdParty/shaderc/shaderc"]
path = Extern/3rdParty/shaderc/shaderc
url = https://github.com/google/shaderc.git
[submodule "Extern/3rdParty/stb/stb"]
path = Extern/3rdParty/stb/stb
url = https://github.com/nothings/stb.git
[submodule "Extern/3rdParty/volk/volk"]
path = Extern/3rdParty/volk/volk
url = https://github.com/zeux/volk.git
[submodule "Extern/3rdParty/VulkanMemoryAllocator/VulkanMemoryAllocator"]
path = Extern/3rdParty/VulkanMemoryAllocator/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "Extern/3rdParty/xatlas/xatlas"]
path = Extern/3rdParty/xatlas/xatlas
url = https://github.com/jpcy/xatlas.git
[submodule "Extern/3rdParty/yaml-cpp/yaml-cpp"]
path = Extern/3rdParty/yaml-cpp/yaml-cpp
url = https://github.com/jbeder/yaml-cpp.git
Submodule VulkanMemoryAllocator added at 009ecd
1 change: 1 addition & 0 deletions Extern/3rdParty/base64/base64
Submodule base64 added at 913b89
38 changes: 38 additions & 0 deletions Extern/3rdParty/csvpp/csvpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#################################################################################
# @project Common
# @brief Common libraries used throughout the project.
# @author Tomas Polasek
#################################################################################

cmake_minimum_required (VERSION 3.9)

set (PROJECT_NAME csvpp)
project (${PROJECT_NAME})

set (PROJECT_HEADERS
include/csvpp.h
include/stringhelper.h
)

set (PROJECT_SOURCES
include/csvpp.cpp
include/stringhelper.cpp
)

add_library (
${PROJECT_NAME}
STATIC
${PROJECT_HEADERS}
${PROJECT_SOURCES}
)

target_include_directories (
${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)

add_library (
${COMMON_LIB}::${PROJECT_NAME}
ALIAS
${PROJECT_NAME}
)
139 changes: 139 additions & 0 deletions Extern/3rdParty/csvpp/csvpp/include/csvpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#include <string>
#include <iostream>
#include <istream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include "csvpp.h"
#include "stringhelper.h"

using namespace std;
using namespace csvpp;

namespace csvpp {

std::ostream & operator<<(std::ostream & os, const RowWriter & r)
{

rowiterator it;
if (r.size() == 0)
return os;

if (!r[0].skipheader)
{
for(unsigned int i = 0; i < r[0].header.size() - 1; i++)
{
os << r[0].header[i] << r[0].delimiter_char;;
}
os << r[0].header[r[0].header.size() - 1] << r[0].newline;
}
for(unsigned int i = 0; i < r.size(); i++)
{
for(it = r[i].begin(); it != r[i].end(); it++)
{
if (distance(r[i].begin(), it) != (int)(r[i].size() - 1))
os << it->second << r[i].delimiter_char;
else
os << it->second;
}
if (!r[0].skipheader && i != 0)
os << r[i].newline;
}

return os;
}

std::istream & operator>>(std::istream & is, RowReader & r)
{
string buffer;
stringstream buffer2;
int currentheader = 0;
getline(is, buffer);
// Patch by damienlmoore - https://code.google.com/p/csvpp/issues/detail?id=1
if(!is.good() || is.eof())
{
return is;
}

buffer = trim_copy(buffer);
char c;
bool startquote = false;
if(r.header.size() == 0 && !r.skipheader)
{

vector<string> sections = split(buffer, r.delimiter_char);
for(unsigned int i = 0; i < sections.size(); i++)
r.header.push_back(sections[i]);
} else {
for(unsigned int i = 0; i < buffer.length(); i++)
{
c = buffer[i];
/*
If the current character is a comma then we may have found the start of the next column
however we do need to test if we are inside of a quote
If we aren't inside of a quote - store the value using the current header 'pointer' and keep scanning
*/
if (c == r.delimiter_char[0])
{
if (startquote)
{
buffer2 << c;
continue;
}
if (!r.skipheader)
{
r[r.header[currentheader]] = buffer2.str();
}
else
{
r[ObjToString(currentheader)] = buffer2.str();
}
buffer2.str(string());
currentheader++;
continue;
}


// If the character is a quote then we need to note this and use that to ignore commas
// added logic to ignore whitespace before and after the whitespace
if (c == '"')
{
if (startquote)
{
buffer2 << '"';
buffer2.str(trim_left_copy(buffer2.str()));
}
if ( (((int)i-1) >= 0 && buffer[i-1] == '\\'))
{
buffer2 << c;
continue;
}
startquote = !startquote;
//find , and move i to it
if (!startquote)
{
for(unsigned int x = i; x < buffer.length(); x++)
{
if (buffer[x] == r.delimiter_char[0] || x == buffer.length())
{
i = x-1;
break;
}
}
}
}

buffer2 << c;
}
if (!r.skipheader)
{
r[r.header[currentheader]] = buffer2.str();
} else {
r[ObjToString(currentheader)] = buffer2.str();
}
}

return is;
}
}
42 changes: 42 additions & 0 deletions Extern/3rdParty/csvpp/csvpp/include/csvpp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef CSVPP_H
#define CSVPP_H

#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <istream>


#define VERSION "2.2"

namespace csvpp {

class RowWriter;

class RowReader : public std::map<std::string, std::string> {
private:
std::vector<std::string> header;
bool skipheader;
std::string delimiter_char; // this is a string because the split function helper is expecting a string, but really this is just a char
public:
const char * newline;
// Adding support for custom delimiter character
// Based on the patch by Hanifa
// https://code.google.com/p/csvpp/issues/detail?id=2
RowReader(std::string delimiter_char = ",", bool skipheader=false,const char * newline="\n") : delimiter_char(delimiter_char), skipheader(skipheader), newline(newline) { }
void clear() { header.clear(); }
friend std::istream & operator>>(std::istream & os, RowReader & r);
friend std::ostream & operator<<(std::ostream & os, const RowWriter & r);
};

class RowWriter : public std::vector<RowReader>
{
public:
friend std::ostream & operator<<(std::ostream & os, const RowWriter & r);
};

typedef RowReader::const_iterator rowiterator;
}

#endif
1 change: 1 addition & 0 deletions Extern/3rdParty/csvpp/csvpp/include/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Taken from: https://srchub.org/p/csvpp/
49 changes: 49 additions & 0 deletions Extern/3rdParty/csvpp/csvpp/include/stringhelper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <string>
#include <vector>
#include "stringhelper.h"

using namespace std;

vector<string> split(const string& s,
const string& match,
bool removeEmpty,
bool fullMatch)
{
vector<string> result; // return container for tokens
string::size_type start = 0, // starting position for searches
skip = 1; // positions to skip after a match
find_t pfind = &string::find_first_of; // search algorithm for matches

if (fullMatch)
{
// use the whole match string as a key
// instead of individual characters
// skip might be 0. see search loop comments
skip = match.length();
pfind = &string::find;
}

while (start != string::npos)
{
// get a complete range [start..end)
string::size_type end = (s.*pfind)(match, start);

// null strings always match in string::find, but
// a skip of 0 causes infinite loops. pretend that
// no tokens were found and extract the whole string
if (skip == 0) end = string::npos;

string token = s.substr(start, end - start);

if (!(removeEmpty && token.empty()))
{
// extract the token and add it to the result list
result.push_back(token);
}

// start the next range
if ((start = end) != string::npos) start += skip;
}

return result;
}
46 changes: 46 additions & 0 deletions Extern/3rdParty/csvpp/csvpp/include/stringhelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef STRINGHELPER_H
#define STRINGHELPER_H
#include <string>
#include <vector>
#include <iterator>
#include <sstream>
//Borrowed from http://www.cplusplus.com/faq/sequences/strings/trim/
inline std::string trim_right_copy(
const std::string& s,
const std::string& delimiters = " \f\n\r\t\v" )
{
return s.substr( 0, s.find_last_not_of( delimiters ) + 1 );
}

inline std::string trim_left_copy(
const std::string& s,
const std::string& delimiters = " \f\n\r\t\v" )
{
return s.substr( s.find_first_not_of( delimiters ) );
}

inline std::string trim_copy(
const std::string& s,
const std::string& delimiters = " \f\n\r\t\v" )
{
return trim_left_copy( trim_right_copy( s, delimiters ), delimiters );
}

typedef std::string::size_type (std::string::*find_t)(const std::string& delim,
std::string::size_type offset) const;

std::vector<std::string> split(const std::string& s,
const std::string& match,
bool removeEmpty=false,
bool fullMatch=false);

//http://stackoverflow.com/a/13636164/195722
template <typename T>
std::string ObjToString ( T obj )
{
std::ostringstream ss;
ss << obj;
return ss.str();
}

#endif
1 change: 1 addition & 0 deletions Extern/3rdParty/eigen/eigen
Submodule eigen added at 1f05f5
1 change: 1 addition & 0 deletions Extern/3rdParty/glfw/glfw
Submodule glfw added at 7b6aea
1 change: 1 addition & 0 deletions Extern/3rdParty/glm/glm
Submodule glm added at 0af55c
1 change: 1 addition & 0 deletions Extern/3rdParty/imgui/ImGuizmo
Submodule ImGuizmo added at 99358b
1 change: 1 addition & 0 deletions Extern/3rdParty/imgui/imgui
Submodule imgui added at 139e99
1 change: 1 addition & 0 deletions Extern/3rdParty/json/json
Submodule json added at 9cca28
1 change: 1 addition & 0 deletions Extern/3rdParty/meshoptimizer/meshoptimizer
Submodule meshoptimizer added at 47aafa
Loading

0 comments on commit df41e0f

Please sign in to comment.