Skip to content

Commit

Permalink
brake the build!
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Zharii committed Mar 10, 2024
1 parent b22698d commit fca61d0
Show file tree
Hide file tree
Showing 4,821 changed files with 20,062 additions and 1,494,447 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 11 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ target_include_directories(${LIBRARY_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nlohmann-json-3.11.2/single_include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/spdlog-1.11.0/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/fmt-9.1.0/include
# Include Poco directories
${CMAKE_CURRENT_SOURCE_DIR}/third-party/poco-poco-1.13.2-release/Foundation/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/poco-poco-1.13.2-release/Net/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/cpr-1.10.5/include
)

target_include_directories(${LIBRARY_NAME}
Expand All @@ -106,18 +104,15 @@ target_include_directories(${LIBRARY_NAME}
# we add the sub-directories that we want CMake to scan
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/clip-1.5)

## nlohmann-json
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/nlohmann-json-3.11.2)
## end of nlohmann-json


## fmt
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/fmt-9.1.0)
## end of fmt

## webview
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/webview-adbb85d-2024-03-09)
## webview
## webview

# There's also (probably) doctests within the library, so we need to see this as well.
target_link_libraries(
Expand All @@ -139,13 +134,16 @@ if(WIN32)
target_link_libraries(${LIBRARY_NAME} PUBLIC wintoastlib)
endif()

## poco
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/poco-poco-1.13.2-release)
##
## cpr
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/cpr-1.10.5)
target_link_libraries(${LIBRARY_NAME} PRIVATE cpr)
## cpr

## nlohmann-json
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/nlohmann-json-3.11.2)
target_link_libraries(${LIBRARY_NAME} PRIVATE nlohmann_json::nlohmann_json)

target_link_libraries(${LIBRARY_NAME} PRIVATE Poco::Foundation Poco::Net)
## end of nlohmann-json

# Set the compile options you want (change as needed).
target_set_warnings(${LIBRARY_NAME} ENABLE ALL AS_ERROR ALL DISABLE Annoying)
Expand Down
30 changes: 8 additions & 22 deletions src/aww-banner-windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace aww::banner
{

// Defines where to place the notification window
enum class NotificationPosition
{
Expand Down Expand Up @@ -116,24 +117,13 @@ namespace aww::banner
titleText = my_class->getTitle();
messageText = my_class->getMessage();

// Convert std::string to std::wstring
int titleLen = MultiByteToWideChar(CP_UTF8, 0, titleText.c_str(), -1, NULL, 0);
std::wstring wideTitleText(titleLen, 0);
MultiByteToWideChar(CP_UTF8, 0, titleText.c_str(), -1, &wideTitleText[0], titleLen);

int messageLen = MultiByteToWideChar(CP_UTF8, 0, messageText.c_str(), -1, NULL, 0);
std::wstring wideMessageText(messageLen, 0);
MultiByteToWideChar(CP_UTF8, 0, messageText.c_str(), -1, &wideMessageText[0], messageLen);

std::cout << "WM_PAINT Title: " << my_class->getTitle() << "\n";
std::cout << "WM_PAINT Message: " << my_class->getMessage() << "\n";

PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);

TextOutW(hdc, 0, 0, wideTitleText.c_str(), static_cast<int>(wideTitleText.length()));
TextOutW(hdc, 0, 16, wideMessageText.c_str(), static_cast<int>(wideMessageText.length()));

TextOut(hdc, 0, 0, titleText.c_str(), static_cast<int>(titleText.length()));
TextOut(hdc, 0, 16, messageText.c_str(), static_cast<int>(messageText.length()));
EndPaint(hwnd, &ps);

SetLayeredWindowAttributes(
Expand Down Expand Up @@ -182,18 +172,14 @@ namespace aww::banner
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = L"myWindowClass";
wc.lpszClassName = "myWindowClass";
RegisterClass(&wc);

int titleLen = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), -1, NULL, 0);
std::wstring wideTitleText(titleLen, 0);
MultiByteToWideChar(CP_UTF8, 0, title.c_str(), -1, &wideTitleText[0], titleLen);

// Create a window
const HWND hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE | WS_EX_LAYERED,
L"myWindowClass",
wideTitleText.c_str(),
"myWindowClass",
title.c_str(),
WS_POPUP | WS_VISIBLE | WS_BORDER,
CW_USEDEFAULT,
CW_USEDEFAULT,
Expand All @@ -219,7 +205,7 @@ namespace aww::banner
CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, VARIABLE_PITCH, TEXT("Arial"));

SendMessage(hwnd, WM_SETFONT, (WPARAM)font, TRUE);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)wideTitleText.c_str());
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)title.c_str());

ShowWindow(hwnd, SW_SHOW);

Expand All @@ -234,4 +220,4 @@ namespace aww::banner

DestroyWindow(hwnd);
}
}
}
53 changes: 9 additions & 44 deletions src/internal/aww-api.cpp
Original file line number Diff line number Diff line change
@@ -1,67 +1,32 @@
#include <iostream>
#include <string>
#include <regex>


#include "spdlog/spdlog.h"
#include "fmt/core.h"
#include "internal/aww-api.hpp"
#include <cpr/cpr.h>

#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
#include <Poco/URI.h>
#include <iostream>
#include <sstream>
#include "internal/aww-api.hpp"

namespace aww::internal::aww_api
{
using namespace Poco::Net;
using namespace Poco;
using namespace std;

int aww_api_main([[maybe_unused]] const std::vector<std::string> &cmdArgs, aww_api_io_dependencies_interface &deps)
{
/*
* NOTE: Read Poco samples at
* third-party/poco-poco-1.13.2-release/Net/samples
*/

spdlog::info("Hello spdlog");
fmt::print("Hello, world from fmt PLEASE REMOVE THIS \b!\n");

std::string requestUrl = "http://example.com";
if (cmdArgs.size() > 0 && !cmdArgs[0].empty() && std::regex_match(cmdArgs[0], std::regex("https?://.*")))
std::string requestUrl = "https://example.com";
if (cmdArgs.size() > 0 && !cmdArgs[0].empty())
{
requestUrl = cmdArgs[0];
}

// The URI we are requesting data from
URI uri(requestUrl);
std::string path(uri.getPathAndQuery());
if (path.empty())
path = "/";

// Create a session using the URI's host and port
HTTPClientSession session(uri.getHost(), uri.getPort());

// Create and send the request
HTTPRequest request(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
session.sendRequest(request);

// Receive the response
HTTPResponse response;

// Print the status and reason for the response
cout << response.getStatus() << " " << response.getReason() << endl;

// Extract the response body
istream &rs = session.receiveResponse(response);
stringstream ss;
StreamCopier::copyStream(rs, ss);
cpr::Response r = cpr::Get(cpr::Url{requestUrl});

// Print the response body
cout << ss.str();
fmt::print("Status code: {}\n", r.status_code);
fmt::print("Content type: {}\n", r.header["content-type"]);
fmt::print("Text: {}\n", r.text);

deps.show_notification("aww api", "It works", aww::call_tag("9mnoizxrhdw"));
return 0;
Expand Down
59 changes: 59 additions & 0 deletions third-party/cpr-1.10.5/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 500
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 2
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: true
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 8
CommentPragmas: '^ IWYU pragma:'
SpaceBeforeParens: ControlStatements
...
41 changes: 41 additions & 0 deletions third-party/cpr-1.10.5/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
Checks: '*,
-cppcoreguidelines-pro-type-static-cast-downcast,
-fuchsia-default-arguments-calls,
-fuchsia-default-arguments,
-fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator,
-fuchsia-statically-constructed-objects,
-hicpp-use-auto,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-readability-implicit-bool-conversion,
-readability-const-return-type,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-llvm-include-order,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-type-vararg,
-hicpp-vararg,
-cppcoreguidelines-owning-memory,
-llvmlibc-callee-namespace,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-hicpp-no-array-decay,
-modernize-pass-by-value,
-cppcoreguidelines-pro-bounds-constant-array-index,
-hicpp-signed-bitwise,
-llvmlibc-implementation-in-namespace,
-llvmlibc-restrict-system-libc-headers,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-altera-unroll-loops,
-altera-id-dependent-backward-branch,
-bugprone-easily-swappable-parameters,
-modernize-return-braced-init-list,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-avoid-do-while
'
WarningsAsErrors: '*'
HeaderFilterRegex: 'src/*.hpp'
FormatStyle: file
58 changes: 58 additions & 0 deletions third-party/cpr-1.10.5/.github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "🐛 Bug report"
description: Something in cpr is not working as expected? Create a report to help us improve.
labels: ["Needs Investigation :mag:", "Bug :bug:"]
body:
- type: markdown
attributes:
value: |
Provide a general summary of the issue in the Title above.
Use Markdown to highlight and format your code!
[https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf)
[https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue](https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue)
⚠️⚠️ If you do not use this template, we will simply close your issue. There are no exceptions for this! These steps, especially the part at the end, are very important to solve your problem quickly and efficiently. Please remember that we are not paid to solve or even answer your issues, so we do all this work in OUR free time. ⚠️⚠️
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the bug is.
placeholder: What happened? Also tell us, what did you expect to happen?
validations:
required: true
- type: textarea
attributes:
label: Example/How to Reproduce
description: "Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant."
value: |
1. Create a `cpr::Session`
2. Set option ...
3. Perform the request
4. See error
validations:
required: true
- type: textarea
attributes:
label: Possible Fix
description: A possible fix for your issue.
placeholder: Not obligatory, but suggest a fix or reason for the bug.
validations:
required: false
- type: dropdown
attributes:
label: Where did you get it from?
multiple: true
options:
- GitHub (branch e.g. master)
- vcpkg
- conan
- NuGet
- Other (specify in "Additional Context/Your Environment")
validations:
required: true
- type: textarea
attributes:
label: Additional Context/Your Environment
description: Provide some additional context for your issue and your environment your are trying to use cpr in.
value: |
- OS:
- Version:
validations:
required: true
Loading

0 comments on commit fca61d0

Please sign in to comment.