-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from dwd/xpath
XPath, descendants, and a splash of Sentry
- Loading branch information
Showing
11 changed files
with
1,061 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,47 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Checkout Sentry Native | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: getsentry/sentry-native | ||
path: sentry-native | ||
- name: Apt dance | ||
run: sudo apt-get update && sudo apt-get upgrade -yy | ||
- name: Install libcurl | ||
run: sudo apt-get install libcurl4-openssl-dev | ||
- name: Make build directory | ||
run: mkdir gtest-build | ||
- name: CMake | ||
run: cd gtest-build && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE-CXX_FLAGS=-Werror .. | ||
- name: Download Coverity Scan | ||
run: curl https://scan.coverity.com/download/linux64 -d 'token=${{ secrets.COVERITY_TOKEN }}&project=dwd%2Frapidxml' -o coverity.tar.gz | ||
- name: Unpack Coverity | ||
run: mkdir coverity && cd coverity && tar xf ../coverity.tar.gz && ln -s cov-analysis-* current | ||
- name: Make | ||
run: cd gtest-build && make | ||
run: cd gtest-build && ../coverity/current/bin/cov-build --dir cov-int make | ||
- name: Run Tests | ||
run: cd gtest-build && ./rapidxml-test | ||
- name: Tar up Coverity output | ||
run: cd gtest-build && tar czf ../cov-build-output.tar.gz cov-int | ||
- name: Upload it | ||
run: | | ||
curl --form token=${{ secrets.COVERITY_TOKEN }} \ | ||
--form [email protected] \ | ||
--form [email protected] \ | ||
--form version="vX" \ | ||
--form description="RapidXML (Dave's Version)" \ | ||
https://scan.coverity.com/builds?project=dwd%2Frapidxml | ||
- name: SonarQube install | ||
uses: SonarSource/sonarcloud-github-c-cpp@v3 | ||
- name: Clean build | ||
run: cd gtest-build && make clean | ||
- name: Build Wrapper | ||
run: cd gtest-build && build-wrapper-linux-x86-64 --out-dir sonar-out make | ||
- name: Sonar Scanner | ||
run: cd gtest-build && sonar-scanner --define sonar.cfamily.compile-commands=sonar-out/compile_commands.json --define sonar.projectKey=dwd-github_rapidxml --define sonar.organization=dwd-github | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// Created by dave on 29/07/2024. | ||
// | ||
|
||
#ifndef RAPIDXML_RAPIDXML_GENERATOR_HPP | ||
#define RAPIDXML_RAPIDXML_GENERATOR_HPP | ||
|
||
#include <coroutine> | ||
#include <iterator> | ||
|
||
namespace rapidxml { | ||
template<typename T> | ||
class generator { | ||
public: | ||
using value_pointer = std::remove_reference<T>::type *; | ||
struct handle_type; | ||
struct promise_type { | ||
value_pointer value; | ||
|
||
std::suspend_always yield_value(T & v) { | ||
value = &v; | ||
return {}; | ||
} | ||
|
||
std::suspend_never initial_suspend() { | ||
return {}; | ||
} | ||
|
||
std::suspend_always final_suspend() noexcept { | ||
return {}; // Change this to std::suspend_always | ||
} | ||
|
||
void return_void() {} | ||
|
||
void unhandled_exception() { | ||
std::terminate(); | ||
} | ||
|
||
generator get_return_object() { | ||
return generator{handle_type{handle_type::from_promise(*this)}}; | ||
} | ||
}; | ||
|
||
struct handle_type : std::coroutine_handle<promise_type> { | ||
explicit handle_type(std::coroutine_handle<promise_type> && h) : std::coroutine_handle<promise_type>(std::move(h)) {} | ||
|
||
T &operator*() { | ||
return *(this->promise().value); | ||
} | ||
|
||
void operator++() { | ||
this->resume(); | ||
} | ||
|
||
bool operator!=(std::default_sentinel_t) const { | ||
return !this->done(); | ||
} | ||
}; | ||
|
||
explicit generator(handle_type h) : m_handle(h) {} | ||
|
||
~generator() { | ||
if (m_handle) | ||
m_handle.destroy(); | ||
} | ||
|
||
handle_type begin() { | ||
return m_handle; | ||
} | ||
|
||
std::default_sentinel_t end() { | ||
return std::default_sentinel; | ||
} | ||
|
||
private: | ||
handle_type m_handle{}; | ||
}; | ||
} | ||
|
||
#endif //RAPIDXML_RAPIDXML_GENERATOR_HPP |
Oops, something went wrong.