mirror of
https://gitlab.com/niansa/commsyfuse.git
synced 2025-03-06 20:48:31 +01:00
Initial commit
This commit is contained in:
commit
a845ec2e88
8 changed files with 3737 additions and 0 deletions
73
.gitignore
vendored
Normal file
73
.gitignore
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
# This file is used to ignore files which are generated
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
*~
|
||||||
|
*.autosave
|
||||||
|
*.a
|
||||||
|
*.core
|
||||||
|
*.moc
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*_pch.h.cpp
|
||||||
|
*_resource.rc
|
||||||
|
*.qm
|
||||||
|
.#*
|
||||||
|
*.*#
|
||||||
|
core
|
||||||
|
!core/
|
||||||
|
tags
|
||||||
|
.DS_Store
|
||||||
|
.directory
|
||||||
|
*.debug
|
||||||
|
Makefile*
|
||||||
|
*.prl
|
||||||
|
*.app
|
||||||
|
moc_*.cpp
|
||||||
|
ui_*.h
|
||||||
|
qrc_*.cpp
|
||||||
|
Thumbs.db
|
||||||
|
*.res
|
||||||
|
*.rc
|
||||||
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
|
||||||
|
# qtcreator generated files
|
||||||
|
*.pro.user*
|
||||||
|
|
||||||
|
# xemacs temporary files
|
||||||
|
*.flc
|
||||||
|
|
||||||
|
# Vim temporary files
|
||||||
|
.*.swp
|
||||||
|
|
||||||
|
# Visual Studio generated files
|
||||||
|
*.ib_pdb_index
|
||||||
|
*.idb
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcproj
|
||||||
|
*vcproj.*.*.user
|
||||||
|
*.ncb
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.vcxproj
|
||||||
|
*vcxproj.*
|
||||||
|
|
||||||
|
# MinGW generated files
|
||||||
|
*.Debug
|
||||||
|
*.Release
|
||||||
|
|
||||||
|
# Python byte code
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
# --------
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
375
CMakeLists.txt.user
Normal file
375
CMakeLists.txt.user
Normal file
|
@ -0,0 +1,375 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<!-- Written by QtCreator 4.8.2, 2020-04-27T13:10:48. -->
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>EnvironmentId</variable>
|
||||||
|
<value type="QByteArray">{351f8bcf-d109-46ca-af43-156a3a43bec7}</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
<value type="int">0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||||
|
<value type="QString" key="language">Cpp</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||||
|
<value type="QString" key="language">QmlJS</value>
|
||||||
|
<valuemap type="QVariantMap" key="value">
|
||||||
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
|
</valuemap>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||||
|
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||||
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
||||||
|
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Linux</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Linux</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{9f9d3e0c-d435-402d-a742-bb242f5fb819}</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
|
<valuelist type="QVariantList" key="CMake.Configuration"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nils/Programme/OSS/CommSyFuse/bin</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">all</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">clean</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Vorgabe</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Vorgabe</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
|
<valuelist type="QVariantList" key="CMake.Configuration">
|
||||||
|
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nils/Programme/OSS/CommSyFuse/bin/</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">all</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">clean</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
|
<valuelist type="QVariantList" key="CMake.Configuration">
|
||||||
|
<value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nils/Programme/OSS/CommSyFuse/bin</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">all</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">clean</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
|
||||||
|
<valuelist type="QVariantList" key="CMake.Configuration">
|
||||||
|
<value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nils/Programme/OSS/CommSyFuse/bin</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">all</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">clean</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release mit Debuginformationen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release mit Debuginformationen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.4">
|
||||||
|
<valuelist type="QVariantList" key="CMake.Configuration">
|
||||||
|
<value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nils/Programme/OSS/CommSyFuse/bin</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">all</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
|
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
|
||||||
|
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
|
||||||
|
<value type="QString">clean</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen mit CMake</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release (kleinstmöglich)</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release (kleinstmöglich)</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">5</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment-Konfiguration</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||||
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||||
|
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||||
|
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||||
|
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||||
|
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||||
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||||
|
<value type="int">0</value>
|
||||||
|
<value type="int">1</value>
|
||||||
|
<value type="int">2</value>
|
||||||
|
<value type="int">3</value>
|
||||||
|
<value type="int">4</value>
|
||||||
|
<value type="int">5</value>
|
||||||
|
<value type="int">6</value>
|
||||||
|
<value type="int">7</value>
|
||||||
|
<value type="int">8</value>
|
||||||
|
<value type="int">9</value>
|
||||||
|
<value type="int">10</value>
|
||||||
|
<value type="int">11</value>
|
||||||
|
<value type="int">12</value>
|
||||||
|
<value type="int">13</value>
|
||||||
|
<value type="int">14</value>
|
||||||
|
</valuelist>
|
||||||
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CommSyFuse</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.CommSyFuse
|
||||||
|
/home/nils/Programme/OSS/CommSyFuse/</value>
|
||||||
|
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||||
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/nils/Programme/OSS/CommSyFuse/bin</value>
|
||||||
|
</valuemap>
|
||||||
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
|
<value type="int">1</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
<value type="int">20</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>Version</variable>
|
||||||
|
<value type="int">20</value>
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
11
CommSyFuse.pro
Normal file
11
CommSyFuse.pro
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
TEMPLATE = app
|
||||||
|
CONFIG += console c++17
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
CONFIG -= qt
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
LIBS += -lcurlpp -lcurl
|
||||||
|
LIBS += -lfuse
|
||||||
|
LIBS += -lgumbo
|
24
bin/.qmake.stash
Normal file
24
bin/.qmake.stash
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 9
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
|
||||||
|
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 1
|
||||||
|
QMAKE_CXX.COMPILER_MACROS = \
|
||||||
|
QT_COMPILER_STDCXX \
|
||||||
|
QMAKE_GCC_MAJOR_VERSION \
|
||||||
|
QMAKE_GCC_MINOR_VERSION \
|
||||||
|
QMAKE_GCC_PATCH_VERSION
|
||||||
|
QMAKE_CXX.INCDIRS = \
|
||||||
|
/usr/include/c++/9 \
|
||||||
|
/usr/include/x86_64-linux-gnu/c++/9 \
|
||||||
|
/usr/include/c++/9/backward \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/9/include \
|
||||||
|
/usr/local/include \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed \
|
||||||
|
/usr/include/x86_64-linux-gnu \
|
||||||
|
/usr/include
|
||||||
|
QMAKE_CXX.LIBDIRS = \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/9 \
|
||||||
|
/usr/lib/x86_64-linux-gnu \
|
||||||
|
/usr/lib \
|
||||||
|
/lib/x86_64-linux-gnu \
|
||||||
|
/lib
|
BIN
bin/CommSyFuse
Executable file
BIN
bin/CommSyFuse
Executable file
Binary file not shown.
0
bin/CommSyFuse.log
Normal file
0
bin/CommSyFuse.log
Normal file
374
main.cpp
Normal file
374
main.cpp
Normal file
|
@ -0,0 +1,374 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
|
#include <csignal>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <curlpp/cURLpp.hpp>
|
||||||
|
#include <curlpp/Easy.hpp>
|
||||||
|
#include <curlpp/Infos.hpp>
|
||||||
|
#include <curlpp/Options.hpp>
|
||||||
|
|
||||||
|
#include <gumbo.h>
|
||||||
|
|
||||||
|
static std::string server_url = "https://unterricht.sh.schulcommsy.de";
|
||||||
|
static std::string server_sid;
|
||||||
|
static std::string room;
|
||||||
|
|
||||||
|
|
||||||
|
void panic(std::string message) {
|
||||||
|
std::cerr << std::endl << "An unhandled exception occured:" << std::endl << message << std::endl;
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string ltrim(const std::string &s) {
|
||||||
|
static const std::regex lws{"^[[:space:]]*", std::regex_constants::extended};
|
||||||
|
return std::regex_replace(s, lws, "");
|
||||||
|
}
|
||||||
|
std::string rtrim(const std::string &s) {
|
||||||
|
static const std::regex tws{"[[:space:]]*$", std::regex_constants::extended};
|
||||||
|
return std::regex_replace(s, tws, "");
|
||||||
|
}
|
||||||
|
std::string trim(const std::string &s) {
|
||||||
|
return ltrim(rtrim(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_filename(std::string &path) {
|
||||||
|
return path.substr(path.find_last_of("/\\") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string clean_spaces(const std::string &s) {
|
||||||
|
static const std::regex tws{"[ ]{2,}", std::regex_constants::extended};
|
||||||
|
std::string newstr = std::regex_replace(s, tws, "");
|
||||||
|
std::replace(newstr.begin(), newstr.end(), '\n', ' ');
|
||||||
|
newstr.erase(0, 4);
|
||||||
|
return newstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> merge_strvects(std::vector<std::string> base, const std::vector<std::string> &addition) {
|
||||||
|
base.insert(base.end(), addition.begin(), addition.end());
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long curlreq(std::stringstream &responsebuffer, std::string SID, std::string URL) {
|
||||||
|
// Initialise variables
|
||||||
|
curlpp::Cleanup cleaner;
|
||||||
|
curlpp::Easy request;
|
||||||
|
// Set the writer callback to enable cURL to write result in a memory area
|
||||||
|
request.setOpt(new curlpp::options::WriteStream(&responsebuffer));
|
||||||
|
// Setting the URL to retrive.
|
||||||
|
request.setOpt(new curlpp::options::Url(URL));
|
||||||
|
// Set SID cookie
|
||||||
|
std::list<std::string> header;
|
||||||
|
header.push_back("Cookie: SID=" + SID);
|
||||||
|
request.setOpt(new curlpp::options::HttpHeader(header));
|
||||||
|
// Perform request
|
||||||
|
request.perform();
|
||||||
|
// Return result
|
||||||
|
return curlpp::infos::ResponseCode::get(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gumbo_search_by_attr(std::vector<GumboNode *> &elemvect, GumboNode* node, std::string attrname, std::string searchword, GumboTag expectedtag) {
|
||||||
|
if (node->type != GUMBO_NODE_ELEMENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GumboAttribute* hclass;
|
||||||
|
if (node->v.element.tag == expectedtag &&
|
||||||
|
(hclass = gumbo_get_attribute(&node->v.element.attributes, attrname.c_str()))) {
|
||||||
|
if (hclass->value == searchword) {
|
||||||
|
elemvect.push_back(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GumboVector* children = &node->v.element.children;
|
||||||
|
for (unsigned int i = 0; i < children->length; ++i) {
|
||||||
|
gumbo_search_by_attr(elemvect, static_cast<GumboNode*>(children->data[i]), attrname, searchword, expectedtag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void gumbo_search_by_class(std::vector<GumboNode *> &elemvect, GumboNode* node, std::string searchword, GumboTag expectedtag) {
|
||||||
|
return gumbo_search_by_attr(elemvect, node, "class", searchword, expectedtag);
|
||||||
|
}
|
||||||
|
GumboNode *gumbo_search_by_id(GumboNode* node, std::string searchword, GumboTag expectedtag) {
|
||||||
|
std::vector<GumboNode *> elemvect;
|
||||||
|
gumbo_search_by_attr(elemvect, node, "id", searchword, expectedtag);
|
||||||
|
// Use first node found
|
||||||
|
if (elemvect.size() > 0) {
|
||||||
|
return elemvect[0];
|
||||||
|
}
|
||||||
|
// If no nodes were found, panic()
|
||||||
|
panic("Not a single node with ID "+searchword+" could be found!");
|
||||||
|
return new GumboNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gumbo_search_by_tag(std::vector<GumboNode *> &elemvect, GumboNode* node, GumboTag searchedtag) {
|
||||||
|
if (node->type != GUMBO_NODE_ELEMENT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (node->v.element.tag == searchedtag) {
|
||||||
|
elemvect.push_back(node);
|
||||||
|
}
|
||||||
|
GumboVector* children = &node->v.element.children;
|
||||||
|
for (unsigned int i = 0; i < children->length; ++i) {
|
||||||
|
gumbo_search_by_tag(elemvect, static_cast<GumboNode*>(children->data[i]), searchedtag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string gumbo_cleantext(GumboNode* node) {
|
||||||
|
if (node->type == GUMBO_NODE_TEXT) {
|
||||||
|
return std::string(node->v.text.text);
|
||||||
|
} else if (node->type == GUMBO_NODE_ELEMENT &&
|
||||||
|
node->v.element.tag != GUMBO_TAG_SCRIPT &&
|
||||||
|
node->v.element.tag != GUMBO_TAG_STYLE) {
|
||||||
|
std::string contents = "";
|
||||||
|
GumboVector* children = &node->v.element.children;
|
||||||
|
for (unsigned int i = 0; i < children->length; ++i) {
|
||||||
|
const std::string text = gumbo_cleantext((GumboNode*) children->data[i]);
|
||||||
|
if (i != 0 && !text.empty()) {
|
||||||
|
contents.append(" ");
|
||||||
|
}
|
||||||
|
contents.append(text);
|
||||||
|
}
|
||||||
|
return contents;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> gumbo_get_attr(GumboNode *node, std::string attrkey, GumboTag expected_tag) {
|
||||||
|
std::vector<std::string> attrvals;
|
||||||
|
GumboNode *childnode;
|
||||||
|
GumboVector* children = &node->v.element.children;
|
||||||
|
std::vector<std::string> toappend;
|
||||||
|
// Check if current element is already the right one
|
||||||
|
if (node->v.element.tag == expected_tag) {
|
||||||
|
// Return this elements wanted attribute key
|
||||||
|
return {gumbo_get_attribute(&node->v.element.attributes, attrkey.c_str())->value};
|
||||||
|
}
|
||||||
|
// Check if This is a node element
|
||||||
|
else if (node->type != GUMBO_NODE_ELEMENT) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
// Iterate through child nodes
|
||||||
|
for (unsigned int it = 0; it < children->length; ++it) {
|
||||||
|
childnode = (GumboNode*) children->data[it];
|
||||||
|
if (childnode->v.element.tag == expected_tag) { // If node is the expected tag; use it
|
||||||
|
attrvals.push_back(gumbo_get_attribute(&childnode->v.element.attributes, attrkey.c_str())->value);
|
||||||
|
} else if (childnode->type == GUMBO_NODE_ELEMENT) { // Else; iterate through its child nodes
|
||||||
|
toappend = gumbo_get_attr(childnode, attrkey, expected_tag);
|
||||||
|
attrvals = merge_strvects(attrvals, toappend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return the final result
|
||||||
|
return attrvals;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string gumbo_find_text_by_tag(GumboNode *node, GumboTag searchtag) {
|
||||||
|
GumboNode *childnode;
|
||||||
|
GumboVector* children = &node->v.element.children;
|
||||||
|
// Iterate through childs
|
||||||
|
for (unsigned int it = 0; it < children->length; ++it) {
|
||||||
|
childnode = (GumboNode*) children->data[it];
|
||||||
|
if (childnode->v.element.tag == searchtag) { // If node is the expected tag; check content
|
||||||
|
return trim(gumbo_cleantext(childnode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic("A tag that was searched for could not be found!");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
auto get_posts(GumboNode *node) {
|
||||||
|
std::vector<GumboNode *> posts;
|
||||||
|
gumbo_search_by_class(posts, node, "uk-comment", GUMBO_TAG_ARTICLE);
|
||||||
|
return posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_post_name(GumboNode *node) {
|
||||||
|
std::vector<GumboNode *> titlenodes;
|
||||||
|
gumbo_search_by_class(titlenodes, node, "uk-comment-title uk-text-truncate", GUMBO_TAG_H4);
|
||||||
|
return trim(gumbo_cleantext(titlenodes[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_post_meta(GumboNode *node) {
|
||||||
|
std::vector<GumboNode *> metanodes;
|
||||||
|
gumbo_search_by_class(metanodes, node, "uk-comment-meta", GUMBO_TAG_DIV);
|
||||||
|
return clean_spaces(trim(gumbo_cleantext(metanodes[1])));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_post_url(GumboNode *node) {
|
||||||
|
std::vector<GumboNode *> titlenodes;
|
||||||
|
gumbo_search_by_class(titlenodes, node, "uk-comment-title uk-text-truncate", GUMBO_TAG_H4);
|
||||||
|
return gumbo_get_attr(titlenodes[0], "href", GUMBO_TAG_A)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::map<std::string, std::string>> get_post_files(GumboNode *node) {
|
||||||
|
std::vector<GumboNode *> metanodes;
|
||||||
|
std::vector<std::string> fileurls;
|
||||||
|
std::vector<std::string> filenames;
|
||||||
|
std::vector<std::map<std::string, std::string>> filenameurlmap;
|
||||||
|
std::map<std::string, std::string> tmpmap;
|
||||||
|
// Get meta nodes
|
||||||
|
gumbo_search_by_class(metanodes, node, "uk-comment-meta", GUMBO_TAG_DIV);
|
||||||
|
// Get URLs
|
||||||
|
fileurls = gumbo_get_attr(metanodes[2], "href", GUMBO_TAG_A);
|
||||||
|
// Get filenames
|
||||||
|
filenames = gumbo_get_attr(metanodes[2], "title", GUMBO_TAG_A);
|
||||||
|
// Generate map
|
||||||
|
auto urlit = fileurls.begin();
|
||||||
|
auto nameit = filenames.begin();
|
||||||
|
while (true) {
|
||||||
|
// Break if last item was reached
|
||||||
|
if (urlit == fileurls.end() or nameit == filenames.end()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Generate temporary map
|
||||||
|
tmpmap = {};
|
||||||
|
tmpmap[*nameit] = *urlit;
|
||||||
|
// Append it to the result vector map
|
||||||
|
filenameurlmap.push_back(tmpmap);
|
||||||
|
// Get next item in both vectors
|
||||||
|
urlit++; nameit++;
|
||||||
|
}
|
||||||
|
return filenameurlmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_post_desc(std::string post_url) {
|
||||||
|
std::string material_id;
|
||||||
|
std::stringstream httpcontent;
|
||||||
|
GumboOutput *post_document;
|
||||||
|
GumboNode *desc_node;
|
||||||
|
std::vector<GumboNode *> results;
|
||||||
|
// Get material ID
|
||||||
|
material_id = get_filename(post_url);
|
||||||
|
// Download post
|
||||||
|
long statuscode = curlreq(httpcontent, server_sid, post_url);
|
||||||
|
// Check statuscode
|
||||||
|
if (statuscode != 200) {
|
||||||
|
panic("Request to download post had a unexpected result: "+std::to_string(statuscode));
|
||||||
|
}
|
||||||
|
// Parse post
|
||||||
|
post_document = gumbo_parse(httpcontent.str().c_str());
|
||||||
|
// Get description element
|
||||||
|
desc_node = gumbo_search_by_id(post_document->root, "description"+material_id, GUMBO_TAG_DIV);
|
||||||
|
// Extract description
|
||||||
|
gumbo_search_by_tag(results, desc_node, GUMBO_TAG_P);
|
||||||
|
// Cencenate occurencies
|
||||||
|
std::string result_string;
|
||||||
|
for (auto it = results.begin(); it != results.end(); it++) {
|
||||||
|
result_string.append(trim(gumbo_cleantext(*it)) + "\n");
|
||||||
|
}
|
||||||
|
// Return first occurence
|
||||||
|
return result_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_rss_url(GumboNode *node) { // Currently unused
|
||||||
|
GumboNode *room_info_elem;
|
||||||
|
// Get room info element
|
||||||
|
room_info_elem = gumbo_search_by_id(node, "room-info", GUMBO_TAG_UL);
|
||||||
|
// Get all a hrefs
|
||||||
|
auto hrefs = gumbo_get_attr(room_info_elem, "href", GUMBO_TAG_A);
|
||||||
|
// Find RSS href
|
||||||
|
for (auto it = hrefs.begin(); it != hrefs.end(); it++) {
|
||||||
|
if ((*it).rfind("/rss/", 0) == 0) {
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Return something even if none was found to prevent undefined behaviour
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
// Check arguments
|
||||||
|
if (argc < 2) {
|
||||||
|
std::cerr << "Usage: " << argv[0] << " <SID> <room>" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// Create required variables
|
||||||
|
server_sid = argv[1];
|
||||||
|
room = argv[2];
|
||||||
|
std::stringstream httpcontent;
|
||||||
|
std::string rss_url;
|
||||||
|
std::vector<std::string> postsmap_numname;
|
||||||
|
std::vector<std::string> postsmap_nummeta;
|
||||||
|
std::vector<std::string> postsmap_numurl;
|
||||||
|
std::vector<std::string> postsmap_numdesc;
|
||||||
|
std::vector<std::vector<std::string>> postsmap_numfileurls;
|
||||||
|
std::vector<std::vector<std::string>> postsmap_numfilenames;
|
||||||
|
std::vector<GumboNode *> postsmap_numnode;
|
||||||
|
GumboOutput *document;
|
||||||
|
// Check connection and download document
|
||||||
|
std::cout << "Connecting to server..." << std::endl;
|
||||||
|
long statuscode = curlreq(httpcontent, server_sid, server_url+"/room/" + room + "/material");
|
||||||
|
if (statuscode == 302) {
|
||||||
|
std::cerr << "Connection error: Invalid SID" << std::endl;
|
||||||
|
return 2;
|
||||||
|
} else if (statuscode == 500) {
|
||||||
|
std::cerr << "Connection error: Invalid room" << std::endl;
|
||||||
|
return 3;
|
||||||
|
} else if (statuscode != 200) {
|
||||||
|
std::cerr << "Connection error: Server error (Code " << statuscode << ")" << std::endl;
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
// Do some stuff
|
||||||
|
document = gumbo_parse(httpcontent.str().c_str());
|
||||||
|
httpcontent.str(std::string()); // Clear buffer just in case we need it later
|
||||||
|
// Get posts
|
||||||
|
auto posts = get_posts(document->root);
|
||||||
|
// Map posts and their corresponding URL to a number
|
||||||
|
unsigned long numposts = 0;
|
||||||
|
for (auto it = posts.begin(); it != posts.end(); it++) {
|
||||||
|
// Get posts name
|
||||||
|
postsmap_numname.push_back(get_post_name(*it));
|
||||||
|
// Get posts meta string
|
||||||
|
postsmap_nummeta.push_back(get_post_meta(*it));
|
||||||
|
// Get posts URL
|
||||||
|
postsmap_numurl.push_back(get_post_url(*it));
|
||||||
|
// Get posts description
|
||||||
|
postsmap_numdesc.push_back(get_post_desc(server_url + *(postsmap_numurl.end() - 1)));
|
||||||
|
// Get posts files
|
||||||
|
auto urlnamefilemap = get_post_files(*it);
|
||||||
|
for (auto it2 = urlnamefilemap.begin(); it2 != urlnamefilemap.end(); it2++) {
|
||||||
|
for (auto const& pair: *it2) {
|
||||||
|
postsmap_numfilenames.push_back({}); postsmap_numfileurls.push_back({});
|
||||||
|
postsmap_numfilenames[numposts].push_back(pair.first);
|
||||||
|
postsmap_numfileurls[numposts].push_back(pair.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Show overview
|
||||||
|
std::cout << numposts << ") " << postsmap_numname[numposts] << " – " << postsmap_nummeta[numposts] << std::endl;
|
||||||
|
numposts++;
|
||||||
|
}
|
||||||
|
// Debug CLI
|
||||||
|
unsigned long userin;
|
||||||
|
while (true) {
|
||||||
|
// Await user input
|
||||||
|
std::cout << "? " << std::flush;
|
||||||
|
std::cin >> userin;
|
||||||
|
// Check if input is valid
|
||||||
|
if (userin >= numposts) {
|
||||||
|
std::cerr << "No such post" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// If required; get posts description and cache it
|
||||||
|
// Print description
|
||||||
|
std::cout << std::endl << std::endl << postsmap_numdesc[userin] << std::endl;
|
||||||
|
// Print informations
|
||||||
|
std::cout << "Post name: " << postsmap_numname[userin] << std::endl;
|
||||||
|
std::cout << "Post URL: " << server_url << postsmap_numurl[userin] << std::endl;
|
||||||
|
if (postsmap_numfilenames[userin].size() != 0) {
|
||||||
|
std::cout << "Post files:" << std::endl;
|
||||||
|
for (unsigned long it = 0; it < postsmap_numfilenames[userin].size(); it++) {
|
||||||
|
std::cout << " – " << postsmap_numfilenames[userin][it] << ": " << server_url << postsmap_numfileurls[userin][it] << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue