├── SolutionProjectModel ├── pch.cpp ├── Solution.cpp ├── cppexec │ ├── expdef.h │ ├── cppexec.vcxproj.filters │ └── expdef.cpp ├── syncproj.exe ├── helloWorld.cpp ├── tests │ └── helloWorld.cpp ├── Solution.h ├── testCppApp.vcxproj.filters ├── pch.h ├── dllmain.cpp ├── packages.config ├── logTesting │ ├── spdlog │ │ ├── version.h │ │ ├── fmt │ │ │ ├── ostr.h │ │ │ ├── fmt.h │ │ │ └── bundled │ │ │ │ ├── LICENSE.rst │ │ │ │ └── locale.h │ │ ├── formatter.h │ │ ├── details │ │ │ ├── null_mutex.h │ │ │ ├── log_msg.h │ │ │ ├── console_globals.h │ │ │ ├── circular_q.h │ │ │ ├── periodic_worker.h │ │ │ ├── async_logger_impl.h │ │ │ ├── mpmc_blocking_q.h │ │ │ ├── fmt_helper.h │ │ │ └── file_helper.h │ │ ├── sinks │ │ │ ├── msvc_sink.h │ │ │ ├── null_sink.h │ │ │ ├── ostream_sink.h │ │ │ ├── sink.h │ │ │ ├── base_sink.h │ │ │ ├── stdout_color_sinks.h │ │ │ ├── basic_file_sink.h │ │ │ ├── dist_sink.h │ │ │ ├── systemd_sink.h │ │ │ ├── syslog_sink.h │ │ │ ├── stdout_sinks.h │ │ │ └── android_sink.h │ │ ├── async_logger.h │ │ └── async.h │ ├── gtest │ │ ├── internal │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gtest.h │ │ │ │ ├── gtest-port.h │ │ │ │ └── gtest-printers.h │ │ │ └── gtest-port-arch.h │ │ └── gtest_prod.h │ └── src │ │ ├── gtest-matchers.cc │ │ ├── gtest-typed-test.cc │ │ └── gtest-test-part.cc ├── VisualStudioInfo.h ├── ProjectFileTypes.cpp ├── testCppApp.cs ├── VCConfiguration.h ├── ProjectFile.h ├── helpers.cpp ├── helpers.h ├── SolutionProjectModel.sln ├── VisualStudioInfo.cpp ├── VCConfiguration.cpp ├── ProjectFile.cpp ├── EnumReflect.h └── testCppApp.vcxproj ├── cppexec.exe ├── VSSyncProj ├── Key.snk ├── Resources │ ├── ExecuteScript.png │ ├── OpenSyncProjectFile.png │ └── OpenSyncProjectFilePackage.ico ├── source.extension.vsixmanifest ├── VSSyncProj.sln ├── packages.config └── ExecuteScript.cs ├── ScriptEngine ├── Key.snk ├── Resources │ ├── ScriptEnginePackage.ico │ └── ProjectScriptLinkCommand.png ├── Properties │ └── AssemblyInfo.cs ├── source.extension.vsixmanifest ├── ScriptEnginePackage.vsct ├── packages.config ├── ScriptEngine.sln └── ScriptEnginePackage.cs ├── SolutionProjectModel.dll ├── thirdparty └── cs-script │ └── CSScriptLibrary.dll ├── Test ├── testScript │ ├── App.config │ ├── testScript2.cs │ ├── testScript.cs │ ├── testScript2.csproj │ └── testScript.csproj ├── ClassLibrary1 │ ├── Class1.cs │ └── ClassLibrary1.csproj └── ClassLibrary2 │ ├── Class2.cs │ └── ClassLibrary2.csproj ├── scriptStarter ├── App.config ├── IpcChannel.cs └── scriptStarter.csproj ├── ScriptEngineStarter ├── App.config ├── IpcChannel.cs └── VsScriptExceptionHandler.cs ├── .gitignore ├── cppscript ├── cppscript.vcxproj.filters ├── cppscript.vcxproj.user ├── cppscript.sln └── cppscript.cpp ├── README.md ├── Tools ├── VSModel │ ├── Program.cs │ └── VSModel.csproj ├── vsStart │ ├── Properties │ │ └── AssemblyInfo1.cs │ ├── vsStart_vs2019.sln │ ├── MessageFilter.cs │ └── Utils.cs ├── VSModelSync │ ├── VSModelSync.sln │ ├── CodeBuilder.cs │ └── VSModelSync.csproj └── vsDev │ └── vsDev2.cs ├── pugixml ├── pugiconfig.hpp └── pugixml.natvis └── CsScriptHotReload.sln /SolutionProjectModel/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | -------------------------------------------------------------------------------- /cppexec.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/cppexec.exe -------------------------------------------------------------------------------- /SolutionProjectModel/Solution.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Solution.h" 3 | 4 | -------------------------------------------------------------------------------- /VSSyncProj/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/VSSyncProj/Key.snk -------------------------------------------------------------------------------- /ScriptEngine/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/ScriptEngine/Key.snk -------------------------------------------------------------------------------- /SolutionProjectModel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/SolutionProjectModel.dll -------------------------------------------------------------------------------- /SolutionProjectModel/cppexec/expdef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int printPeExports(const wchar_t* dllPath); 4 | 5 | -------------------------------------------------------------------------------- /SolutionProjectModel/syncproj.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/SolutionProjectModel/syncproj.exe -------------------------------------------------------------------------------- /VSSyncProj/Resources/ExecuteScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/VSSyncProj/Resources/ExecuteScript.png -------------------------------------------------------------------------------- /thirdparty/cs-script/CSScriptLibrary.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/thirdparty/cs-script/CSScriptLibrary.dll -------------------------------------------------------------------------------- /ScriptEngine/Resources/ScriptEnginePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/ScriptEngine/Resources/ScriptEnginePackage.ico -------------------------------------------------------------------------------- /VSSyncProj/Resources/OpenSyncProjectFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/VSSyncProj/Resources/OpenSyncProjectFile.png -------------------------------------------------------------------------------- /ScriptEngine/Resources/ProjectScriptLinkCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/ScriptEngine/Resources/ProjectScriptLinkCommand.png -------------------------------------------------------------------------------- /VSSyncProj/Resources/OpenSyncProjectFilePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapika/cppscriptcore/HEAD/VSSyncProj/Resources/OpenSyncProjectFilePackage.ico -------------------------------------------------------------------------------- /SolutionProjectModel/helloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | void main(void) 6 | { 7 | printf("Hello world"); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SolutionProjectModel/tests/helloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | void main(void) 6 | { 7 | printf("Hello world"); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SolutionProjectModel/Solution.h: -------------------------------------------------------------------------------- 1 | #include "Project.h" 2 | 3 | class SPM_DLLEXPORT Solution : public pugi::xml_document 4 | { 5 | public: 6 | 7 | 8 | }; 9 | 10 | -------------------------------------------------------------------------------- /Test/testScript/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /scriptStarter/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ScriptEngineStarter/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SolutionProjectModel/testCppApp.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SolutionProjectModel/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | -------------------------------------------------------------------------------- /SolutionProjectModel/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #define _WIN32_WINNT _WIN32_WINNT_WIN7 /*0x0601*/ 3 | #include 4 | #include 5 | 6 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 7 | { 8 | return TRUE; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SolutionProjectModel/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #----------------------------------------- 2 | # Files to ignore 3 | #----------------------------------------- 4 | /Tools/VSModelSync/ignoreAsms.txt 5 | /Tools/VSModelSync/VSModelSync.pdb 6 | /Tools/VSModelSync/VSModelSync.exe 7 | /Tools/VSModelSync/dump.cs 8 | /vsmodel 9 | bin 10 | obj 11 | .vs 12 | packages 13 | *.user 14 | *Copy.cs 15 | -------------------------------------------------------------------------------- /Test/ClassLibrary1/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public class Class1 5 | { 6 | static public List dataList = new List(); 7 | 8 | static public void HelloClass1() 9 | { 10 | Console.WriteLine("HelloClass1"); 11 | Console.WriteLine("Data: " + String.Join(" ", dataList)); 12 | } 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /Test/ClassLibrary2/Class2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public class Class2 5 | { 6 | static public List dataList = new List(); 7 | 8 | static public void HelloClass2() 9 | { 10 | Console.WriteLine("HelloClass2"); 11 | Console.WriteLine("Data: " + String.Join(" ", dataList)); 12 | } 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/version.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #define SPDLOG_VER_MAJOR 1 9 | #define SPDLOG_VER_MINOR 3 10 | #define SPDLOG_VER_PATCH 1 11 | 12 | #define SPDLOG_VERSION (SPDLOG_VER_MAJOR * 10000 + SPDLOG_VER_MINOR * 100 + SPDLOG_VER_PATCH) 13 | -------------------------------------------------------------------------------- /SolutionProjectModel/cppexec/cppexec.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/fmt/ostr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // include bundled or external copy of fmtlib's ostream support 9 | // 10 | #if !defined(SPDLOG_FMT_EXTERNAL) 11 | #ifndef FMT_HEADER_ONLY 12 | #define FMT_HEADER_ONLY 13 | #endif 14 | #include "bundled/ostream.h" 15 | #include "fmt.h" 16 | #else 17 | #include 18 | #endif 19 | -------------------------------------------------------------------------------- /SolutionProjectModel/VisualStudioInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "helpers.h" 5 | 6 | typedef struct 7 | { 8 | int version; 9 | std::wstring InstallPath; 10 | }VisualStudioInfo; 11 | 12 | // 13 | // Queries for all currently installed Visual Studio versions on given machine. 14 | // 15 | // Function throws exception is any COM error occurs. 16 | // 17 | std::vector SPM_DLLEXPORT getInstalledVisualStudios(void); 18 | 19 | -------------------------------------------------------------------------------- /ScriptEngine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("ScriptEngine")] 5 | 6 | // Setting ComVisible to false makes the types in this assembly not visible 7 | // to COM components. If you need to access a type in this assembly from 8 | // COM, set the ComVisible attribute to true on that type. 9 | [assembly: ComVisible(false)] 10 | 11 | [assembly: AssemblyVersion("1.0.0.0")] 12 | [assembly: AssemblyFileVersion("1.0.0.0")] 13 | 14 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "fmt/fmt.h" 9 | #include "spdlog/details/log_msg.h" 10 | 11 | namespace spdlog { 12 | 13 | class formatter 14 | { 15 | public: 16 | virtual ~formatter() = default; 17 | virtual void format(const details::log_msg &msg, fmt::memory_buffer &dest) = 0; 18 | virtual std::unique_ptr clone() const = 0; 19 | }; 20 | } // namespace spdlog 21 | -------------------------------------------------------------------------------- /SolutionProjectModel/ProjectFileTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Project.h" 3 | #include "ProjectFileTypes.h" 4 | #include "VCConfiguration.h" 5 | 6 | using namespace pugi; 7 | using namespace std; 8 | 9 | void ProjectToolProperties::OnAfterSetProperty(ReflectPath& path) 10 | { 11 | USES_CONVERSION; 12 | 13 | if( !projectFile ) 14 | return; 15 | 16 | xml_node node = LocateInsert(projectFile->node, true, CA2W(path.steps.front().propertyName), configurationName.c_str(), platform.c_str()); 17 | ReflectCopyValue(path, node); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /SolutionProjectModel/testCppApp.cs: -------------------------------------------------------------------------------- 1 | //css_ref syncproj.exe 2 | using System; 3 | 4 | partial class Builder : SolutionProjectBuilder 5 | { 6 | static void Main(String[] args) 7 | { 8 | project("HelloWorld2"); 9 | platforms("Win32", "x64"); 10 | vsver(2017); 11 | kind("ConsoleApp"); 12 | files("HelloWorld.cpp"); 13 | targetdir(@"$(ProjectDir)\bin\$(Platform)_$(Configuration)\"); 14 | objdir(@"$(ProjectDir)\obj\$(Platform)_$(Configuration)\"); 15 | //symbols("on"); 16 | //optimize("off"); 17 | } 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/fmt/fmt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Include a bundled header-only copy of fmtlib or an external one. 10 | // By default spdlog include its own copy. 11 | // 12 | 13 | #if !defined(SPDLOG_FMT_EXTERNAL) 14 | #ifndef FMT_HEADER_ONLY 15 | #define FMT_HEADER_ONLY 16 | #endif 17 | #ifndef FMT_USE_WINDOWS_H 18 | #define FMT_USE_WINDOWS_H 0 19 | #endif 20 | #include "bundled/core.h" 21 | #include "bundled/format.h" 22 | #else // external fmtlib 23 | #include 24 | #include 25 | #endif 26 | -------------------------------------------------------------------------------- /Test/testScript/testScript2.cs: -------------------------------------------------------------------------------- 1 | //css_ref ..\..\bin\scriptStarter.exe 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | class Program 9 | { 10 | // Must be here when using EnvDTE 11 | [STAThread] 12 | public static void Main() 13 | { 14 | ScriptHost.ConnectDebugger(); 15 | //Console.Clear(); 16 | //Console.WriteLine(DateTime.Now.ToString()); 17 | Console.WriteLine(__FILE__() + ": Hello !"); 18 | //for (int i = 0; i < 10; i++) 19 | // Console.WriteLine("Hello " + i.ToString()); 20 | } 21 | 22 | static string __FILE__([System.Runtime.CompilerServices.CallerFilePath] string fileName = "") 23 | { 24 | return fileName; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cppscript/cppscript.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | pugixml 7 | 8 | 9 | 10 | 11 | {024eabe8-e819-4d0b-a8d8-2d1a4143578c} 12 | 13 | 14 | 15 | 16 | pugixml 17 | 18 | 19 | pugixml 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # C++ Script core 2 | 3 | This repository contains set of projects and tools to be able to make C++ scriptable and debuggable. 4 | 5 | Initial presentation on what is already working: 6 | 7 | - C++ Runtime Type Reflection
8 | https://docs.google.com/presentation/d/1xo0sg10C4DN4iHSD9wqmqZ_99FeVrxI-RcZqxMs_M7Y/edit?usp=sharing 9 | 10 | Presentation on C# scripting support: 11 | 12 | - Boost Development Productivity: C# hot module / hotreloading scripting support
13 | https://www.youtube.com/watch?v=TrYOaNUXJBk&list=PL-VOKR3HzVrlZt8Le-MkjL73bkASeG1zG 14 | 15 | ---------------------------------------------------------------------------------- 16 | Analogue projects can be found for example from here: 17 | 18 | - Runtime Compiled C++
19 | https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledCPlusPlus 20 | 21 | - CLing
22 | https://cdn.rawgit.com/root-project/cling/master/www/index.html 23 | 24 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | // null, no cost dummy "mutex" and dummy "atomic" int 10 | 11 | namespace spdlog { 12 | namespace details { 13 | struct null_mutex 14 | { 15 | void lock() {} 16 | void unlock() {} 17 | bool try_lock() 18 | { 19 | return true; 20 | } 21 | }; 22 | 23 | struct null_atomic_int 24 | { 25 | int value; 26 | null_atomic_int() = default; 27 | 28 | explicit null_atomic_int(int val) 29 | : value(val) 30 | { 31 | } 32 | 33 | int load(std::memory_order) const 34 | { 35 | return value; 36 | } 37 | 38 | void store(int val) 39 | { 40 | value = val; 41 | } 42 | }; 43 | 44 | } // namespace details 45 | } // namespace spdlog 46 | -------------------------------------------------------------------------------- /Test/testScript/testScript.cs: -------------------------------------------------------------------------------- 1 | //xss_ref ..\..\bin\ClassLibrary1.dll 2 | //css_ref ..\..\bin\ClassLibrary2.dll 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | class Program 10 | { 11 | // Must be here when using EnvDTE 12 | [STAThread] 13 | public static void Main() 14 | { 15 | ScriptHost.ConnectDebugger(); 16 | //Class2.dataList.Add("testScript.Main was here"); 17 | Console.Clear(); 18 | Class2.HelloClass2(); 19 | Class1.HelloClass1(); 20 | //Console.WriteLine(DateTime.Now.ToString()); 21 | Console.WriteLine(__FILE__() + ": Hello !"); 22 | //for (int i = 0; i < 10; i++) 23 | // Console.WriteLine("Hello " + i.ToString()); 24 | } 25 | 26 | static string __FILE__([System.Runtime.CompilerServices.CallerFilePath] string fileName = "") 27 | { 28 | return fileName; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Tools/VSModel/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Xml; 8 | using System.Xml.Linq; 9 | using System.Xml.Serialization; 10 | using VSSync.VCProjectEngine; 11 | 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | //VCLinkerTool link = new VCLinkerTool(); 17 | //link.SubSystem = subSystemOption.subSystemConsole; 18 | 19 | //XmlSerializer xsSubmit = new XmlSerializer(typeof(VCLinkerTool)); 20 | //var xml = ""; 21 | 22 | //using (var sww = new StringWriter()) 23 | //{ 24 | // using (XmlWriter writer = XmlWriter.Create(sww)) 25 | // { 26 | // xsSubmit.Serialize(writer, link); 27 | // xml = sww.ToString(); 28 | // } 29 | //} 30 | 31 | String f = @"\PrototypingQuick\ConsoleApplication1\ConsoleApplication1.vcxproj"; 32 | XDocument doc = XDocument.Load(f, LoadOptions.PreserveWhitespace); 33 | doc.Save(f + "2.xml", SaveOptions.DisableFormatting); 34 | } 35 | 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /SolutionProjectModel/VCConfiguration.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ProjectFile.h" 3 | #include 4 | #include 5 | 6 | class Project; 7 | 8 | 9 | class SPM_DLLEXPORT VCConfiguration : public PlatformConfigurationProperties, public ReflectClassT 10 | { 11 | public: 12 | Project* project; 13 | pugi::xml_node idgConfNode; 14 | pugi::xml_node pgNode; 15 | pugi::xml_node pgConfigurationNode; 16 | 17 | VCConfiguration() : 18 | project(nullptr) 19 | { 20 | // Define configuration "category" (will be used when serializing / restoring) 21 | Linker.propertyName = "Link"; 22 | CCpp.propertyName = "ClCompile"; 23 | ReflectConnectChildren(nullptr); 24 | } 25 | 26 | virtual void OnAfterSetProperty(ReflectPath& path); 27 | 28 | // 29 | // Individual tools settings, depending on project type (static library, dynamic library) individual tool configuration is not necessarily used. 30 | // 31 | REFLECTABLE(VCConfiguration, 32 | (GeneralConf)General, 33 | (CCppConf)CCpp, 34 | (LinkerConf)Linker 35 | ); 36 | }; 37 | 38 | void ReflectCopy(ReflectPath& path, pugi::xml_node toNode); 39 | void ReflectCopyValue(ReflectPath& path, pugi::xml_node node); 40 | 41 | 42 | -------------------------------------------------------------------------------- /cppscript/cppscript.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} 5 | WindowsLocalDebugger 6 | 7 | 8 | {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} 9 | WindowsLocalDebugger 10 | 11 | 12 | {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} 13 | WindowsLocalDebugger 14 | 15 | 16 | {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/msvc_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Alexander Dalshov. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #if defined(_WIN32) 13 | 14 | #include "spdlog/details/null_mutex.h" 15 | #include "spdlog/sinks/base_sink.h" 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | namespace spdlog { 23 | namespace sinks { 24 | /* 25 | * MSVC sink (logging using OutputDebugStringA) 26 | */ 27 | template 28 | class msvc_sink : public base_sink 29 | { 30 | public: 31 | explicit msvc_sink() {} 32 | 33 | protected: 34 | void sink_it_(const details::log_msg &msg) override 35 | { 36 | 37 | fmt::memory_buffer formatted; 38 | sink::formatter_->format(msg, formatted); 39 | OutputDebugStringA(fmt::to_string(formatted).c_str()); 40 | } 41 | 42 | void flush_() override {} 43 | }; 44 | 45 | using msvc_sink_mt = msvc_sink; 46 | using msvc_sink_st = msvc_sink; 47 | 48 | using windebug_sink_mt = msvc_sink_mt; 49 | using windebug_sink_st = msvc_sink_st; 50 | 51 | } // namespace sinks 52 | } // namespace spdlog 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /SolutionProjectModel/ProjectFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "ProjectFileTypes.h" 5 | 6 | class Project; 7 | 8 | // 9 | // Information about that particular file. 10 | // 11 | class SPM_DLLEXPORT ProjectFile : public ReflectClassT 12 | { 13 | public: 14 | ProjectFile(); 15 | 16 | REFLECTABLE(ProjectFile, 17 | (ProjectItemGeneralConf)General 18 | ); 19 | 20 | void VisitTool( 21 | std::function visitConf, 22 | CppTypeInfo* confType, // Type to create, null if just to locate 23 | const wchar_t* configurationName = nullptr, 24 | const wchar_t* platform = nullptr 25 | ); 26 | 27 | // Generic autoprobe - file extension to guessed type. 28 | static EItemType GetFromPath(const wchar_t* file); 29 | 30 | // Relative path to file (from project path perspective) 31 | std::wstring relativePath; 32 | 33 | virtual void OnAfterSetProperty(ReflectPath& path); 34 | 35 | // Configuration/platform specific tools 36 | std::vector< std::shared_ptr > tools; 37 | 38 | // Xml node containing child xml data. 39 | pugi::xml_node node; 40 | 41 | //Project owning this file 42 | Project* project; 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /VSSyncProj/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | VSSyncProj 6 | Empty VSIX Project. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | 17 | namespace spdlog { 18 | namespace sinks { 19 | 20 | template 21 | class null_sink : public base_sink 22 | { 23 | protected: 24 | void sink_it_(const details::log_msg &) override {} 25 | void flush_() override {} 26 | }; 27 | 28 | using null_sink_mt = null_sink; 29 | using null_sink_st = null_sink; 30 | 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr null_logger_mt(const std::string &logger_name) 35 | { 36 | auto null_logger = Factory::template create(logger_name); 37 | null_logger->set_level(level::off); 38 | return null_logger; 39 | } 40 | 41 | template 42 | inline std::shared_ptr null_logger_st(const std::string &logger_name) 43 | { 44 | auto null_logger = Factory::template create(logger_name); 45 | null_logger->set_level(level::off); 46 | return null_logger; 47 | } 48 | 49 | } // namespace spdlog 50 | -------------------------------------------------------------------------------- /ScriptEngine/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ScriptEngine 6 | Script supportProject for supporting 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/fmt/bundled/LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2016, Victor Zverovich 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /Tools/vsStart/Properties/AssemblyInfo1.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("vsStart.Properties")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("vsStart.Properties")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c295edfa-89e3-4729-8520-8cc9890c90b6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /SolutionProjectModel/helpers.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "helpers.h" 3 | #include //CStringA 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | void SPM_DLLEXPORT throwFormat(const char* format, ...) 11 | { 12 | va_list args; 13 | va_start(args, format); 14 | 15 | throw exception(svaFormat(format, args).c_str()); 16 | } 17 | 18 | string GetLastErrorMessageA( DWORD code ) 19 | { 20 | char* buf = nullptr; 21 | DWORD len = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 22 | NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buf, 0, NULL); 23 | 24 | if (!len) 25 | return sFormat("Windows error: %d", code); 26 | 27 | string msg(buf, len); 28 | LocalFree(buf); 29 | return msg; 30 | } 31 | 32 | void ThrowLastError(DWORD code) 33 | { 34 | throw exception(GetLastErrorMessageA(code).c_str()); 35 | } 36 | 37 | int ExecCmd(const wchar_t* cmd) 38 | { 39 | array buffer; 40 | string r; 41 | FILE* pipe = _wpopen(cmd, L"r"); 42 | if (!pipe) 43 | throwFormat("Failed to create process '%S'", cmd); 44 | 45 | while (fgets(buffer.data(), (int)buffer.size(), pipe) != nullptr) 46 | r += buffer.data(); 47 | 48 | int code = _pclose(pipe); 49 | if(code != 0) 50 | throwFormat("\n\n%s\n\nCommand '%S'", r.c_str(), cmd); 51 | 52 | return code; 53 | } 54 | -------------------------------------------------------------------------------- /cppscript/cppscript.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppscript", "cppscript.vcxproj", "{554DCA95-1B50-4AF5-B90A-503F3EB07159}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Debug|x64.ActiveCfg = Debug|x64 17 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Debug|x64.Build.0 = Debug|x64 18 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Debug|x86.ActiveCfg = Debug|Win32 19 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Debug|x86.Build.0 = Debug|Win32 20 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Release|x64.ActiveCfg = Release|x64 21 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Release|x64.Build.0 = Release|x64 22 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Release|x86.ActiveCfg = Release|Win32 23 | {554DCA95-1B50-4AF5-B90A-503F3EB07159}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {DAF4C44C-200D-4AFD-BB7D-5659A2EAE59C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/common.h" 9 | #include "spdlog/details/os.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace spdlog { 15 | namespace details { 16 | struct log_msg 17 | { 18 | 19 | log_msg(source_loc loc, const std::string *loggers_name, level::level_enum lvl, string_view_t view) 20 | : logger_name(loggers_name) 21 | , level(lvl) 22 | #ifndef SPDLOG_NO_DATETIME 23 | , time(os::now()) 24 | #endif 25 | 26 | #ifndef SPDLOG_NO_THREAD_ID 27 | , thread_id(os::thread_id()) 28 | #endif 29 | , source(loc) 30 | , payload(view) 31 | { 32 | } 33 | 34 | log_msg(const std::string *loggers_name, level::level_enum lvl, string_view_t view) 35 | : log_msg(source_loc{}, loggers_name, lvl, view) 36 | { 37 | } 38 | 39 | log_msg(const log_msg &other) = default; 40 | 41 | const std::string *logger_name{nullptr}; 42 | level::level_enum level{level::off}; 43 | log_clock::time_point time; 44 | size_t thread_id{0}; 45 | size_t msg_id{0}; 46 | 47 | // wrapping the formatted text with color (updated by pattern_formatter). 48 | mutable size_t color_range_start{0}; 49 | mutable size_t color_range_end{0}; 50 | 51 | source_loc source; 52 | const string_view_t payload; 53 | }; 54 | } // namespace details 55 | } // namespace spdlog 56 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/null_mutex.h" 13 | #include "spdlog/sinks/base_sink.h" 14 | 15 | #include 16 | #include 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | template 21 | class ostream_sink final : public base_sink 22 | { 23 | public: 24 | explicit ostream_sink(std::ostream &os, bool force_flush = false) 25 | : ostream_(os) 26 | , force_flush_(force_flush) 27 | { 28 | } 29 | ostream_sink(const ostream_sink &) = delete; 30 | ostream_sink &operator=(const ostream_sink &) = delete; 31 | 32 | protected: 33 | void sink_it_(const details::log_msg &msg) override 34 | { 35 | fmt::memory_buffer formatted; 36 | sink::formatter_->format(msg, formatted); 37 | ostream_.write(formatted.data(), static_cast(formatted.size())); 38 | if (force_flush_) 39 | { 40 | ostream_.flush(); 41 | } 42 | } 43 | 44 | void flush_() override 45 | { 46 | ostream_.flush(); 47 | } 48 | 49 | std::ostream &ostream_; 50 | bool force_flush_; 51 | }; 52 | 53 | using ostream_sink_mt = ostream_sink; 54 | using ostream_sink_st = ostream_sink; 55 | 56 | } // namespace sinks 57 | } // namespace spdlog 58 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/console_globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #include "spdlog/details/null_mutex.h" 8 | #include 9 | #include 10 | 11 | #ifdef _WIN32 12 | 13 | #ifndef NOMINMAX 14 | #define NOMINMAX // prevent windows redefining min/max 15 | #endif 16 | 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif 20 | 21 | #include 22 | #endif 23 | 24 | namespace spdlog { 25 | namespace details { 26 | struct console_stdout 27 | { 28 | static std::FILE *stream() 29 | { 30 | return stdout; 31 | } 32 | #ifdef _WIN32 33 | static HANDLE handle() 34 | { 35 | return ::GetStdHandle(STD_OUTPUT_HANDLE); 36 | } 37 | #endif 38 | }; 39 | 40 | struct console_stderr 41 | { 42 | static std::FILE *stream() 43 | { 44 | return stderr; 45 | } 46 | #ifdef _WIN32 47 | static HANDLE handle() 48 | { 49 | return ::GetStdHandle(STD_ERROR_HANDLE); 50 | } 51 | #endif 52 | }; 53 | 54 | struct console_mutex 55 | { 56 | using mutex_t = std::mutex; 57 | static mutex_t &mutex() 58 | { 59 | static mutex_t s_mutex; 60 | return s_mutex; 61 | } 62 | }; 63 | 64 | struct console_nullmutex 65 | { 66 | using mutex_t = null_mutex; 67 | static mutex_t &mutex() 68 | { 69 | static mutex_t s_mutex; 70 | return s_mutex; 71 | } 72 | }; 73 | } // namespace details 74 | } // namespace spdlog 75 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "spdlog/details/log_msg.h" 9 | #include "spdlog/details/pattern_formatter.h" 10 | #include "spdlog/formatter.h" 11 | 12 | namespace spdlog { 13 | namespace sinks { 14 | class sink 15 | { 16 | public: 17 | sink() = default; 18 | 19 | explicit sink(std::unique_ptr formatter) 20 | : formatter_{std::move(formatter)} 21 | { 22 | } 23 | 24 | virtual ~sink() = default; 25 | virtual void log(const details::log_msg &msg) = 0; 26 | virtual void flush() = 0; 27 | virtual void set_pattern(const std::string &pattern) = 0; 28 | virtual void set_formatter(std::unique_ptr sink_formatter) = 0; 29 | 30 | bool should_log(level::level_enum msg_level) const 31 | { 32 | return msg_level >= level_.load(std::memory_order_relaxed); 33 | } 34 | 35 | void set_level(level::level_enum log_level) 36 | { 37 | level_.store(log_level); 38 | } 39 | 40 | level::level_enum level() const 41 | { 42 | return static_cast(level_.load(std::memory_order_relaxed)); 43 | } 44 | 45 | protected: 46 | // sink log level - default is all 47 | level_t level_{level::trace}; 48 | 49 | // sink formatter - default is full format 50 | std::unique_ptr formatter_{details::make_unique()}; 51 | }; 52 | 53 | } // namespace sinks 54 | } // namespace spdlog 55 | -------------------------------------------------------------------------------- /cppscript/cppscript.cpp: -------------------------------------------------------------------------------- 1 | #include "..\pugixml\pugixml.hpp" 2 | #include 3 | #include 4 | 5 | using namespace pugi; 6 | 7 | int main(void) 8 | { 9 | time_t start, end; 10 | time(&start); 11 | { 12 | xml_document doc; 13 | CString f(L"\\PrototypingQuick\\ConsoleApplication1\\ConsoleApplication1.vcxproj"); 14 | xml_parse_result res = doc.load_file(f, parse_default | parse_declaration | parse_ws_pcdata_single); 15 | 16 | xml_node node = doc.select_node(L"/Project/ItemGroup[@Label='ProjectConfigurations']").node(); 17 | 18 | for (xml_node conf : node.children()) 19 | { 20 | //printf("%S\r\n", conf.attribute(L"Include").value()); 21 | printf("Configuration = %S , ", conf.child(L"Configuration").text().get()); 22 | printf("Platform = %S\r\n", conf.child(L"Platform").text().get()); 23 | } 24 | 25 | 26 | //xml_node root = doc.child(L"Project"); 27 | //xml_attribute attrb = root.attribute(L"DefaultTargets"); 28 | //const wchar_t* name = root.name(); 29 | 30 | //auto root = doc.append_child(L"Project"); 31 | 32 | //pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); 33 | //decl.append_attribute(L"version") = L"1.0"; 34 | //decl.append_attribute(L"encoding") = L"utf-8"; 35 | 36 | //root.append_attribute(L"DefaultTargets").set_value(L"Build"); 37 | //root.append_attribute(L"ToolsVersion").set_value(L"15.0"); 38 | //root.append_attribute(L"xmlns").set_value(L"http://schemas.microsoft.com/developer/msbuild/2003"); 39 | 40 | 41 | doc.save_file((f + L"2.xml").GetBuffer(), L" ", format_indent | format_save_file_text, encoding_utf8); 42 | 43 | } 44 | time(&end); 45 | double dif = difftime(end, start); 46 | printf("Elasped time is %.2lf seconds.\r\n", dif); 47 | 48 | return 0; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/circular_q.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | // cirucal q view of std::vector. 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace spdlog { 12 | namespace details { 13 | template 14 | class circular_q 15 | { 16 | public: 17 | using item_type = T; 18 | 19 | explicit circular_q(size_t max_items) 20 | : max_items_(max_items + 1) // one item is reserved as marker for full q 21 | , v_(max_items_) 22 | { 23 | } 24 | 25 | // push back, overrun (oldest) item if no room left 26 | void push_back(T &&item) 27 | { 28 | v_[tail_] = std::move(item); 29 | tail_ = (tail_ + 1) % max_items_; 30 | 31 | if (tail_ == head_) // overrun last item if full 32 | { 33 | head_ = (head_ + 1) % max_items_; 34 | ++overrun_counter_; 35 | } 36 | } 37 | 38 | // Pop item from front. 39 | // If there are no elements in the container, the behavior is undefined. 40 | void pop_front(T &popped_item) 41 | { 42 | popped_item = std::move(v_[head_]); 43 | head_ = (head_ + 1) % max_items_; 44 | } 45 | 46 | bool empty() 47 | { 48 | return tail_ == head_; 49 | } 50 | 51 | bool full() 52 | { 53 | // head is ahead of the tail by 1 54 | return ((tail_ + 1) % max_items_) == head_; 55 | } 56 | 57 | size_t overrun_counter() const 58 | { 59 | return overrun_counter_; 60 | } 61 | 62 | private: 63 | size_t max_items_; 64 | typename std::vector::size_type head_ = 0; 65 | typename std::vector::size_type tail_ = 0; 66 | 67 | std::vector v_; 68 | 69 | size_t overrun_counter_ = 0; 70 | }; 71 | } // namespace details 72 | } // namespace spdlog 73 | -------------------------------------------------------------------------------- /Tools/VSModelSync/VSModelSync.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSModelSync", "VSModelSync.csproj", "{366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSModel", "..\VSModel\VSModel.csproj", "{2807D6B3-0F45-491C-8D18-883EEB0CF412}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3} = {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3} 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3}.Release|Any CPU.Build.0 = Release|Any CPU 23 | {2807D6B3-0F45-491C-8D18-883EEB0CF412}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {2807D6B3-0F45-491C-8D18-883EEB0CF412}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {2807D6B3-0F45-491C-8D18-883EEB0CF412}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {2807D6B3-0F45-491C-8D18-883EEB0CF412}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | GlobalSection(ExtensibilityGlobals) = postSolution 32 | SolutionGuid = {FCFD8F0E-0F97-4E3A-ACDC-F8CF29197A48} 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /scriptStarter/IpcChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO.MemoryMappedFiles; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | public class IpcChannel 10 | { 11 | EventWaitHandle ask; 12 | EventWaitHandle reply; 13 | MemoryMappedFile mmf; 14 | 15 | public IpcChannel(int processId) 16 | { 17 | ask = new EventWaitHandle(false, EventResetMode.ManualReset, "ask_Scripter_IpcChannel_" + processId); 18 | reply = new EventWaitHandle(false, EventResetMode.ManualReset, "reply_Scripter_IpcChannel_" + processId); 19 | mmf = MemoryMappedFile.CreateOrOpen("Scripter_IpcChannel_" + processId, 1000); 20 | } 21 | 22 | public bool Send(String msg) 23 | { 24 | using (MemoryMappedViewStream stream = mmf.CreateViewStream()) 25 | { 26 | byte[] buf = Encoding.UTF8.GetBytes(msg); 27 | byte[] bufLen = BitConverter.GetBytes(buf.Length); 28 | stream.Write(bufLen, 0, bufLen.Length); 29 | stream.Write(buf, 0, buf.Length); 30 | } 31 | ask.Set(); 32 | 33 | // Really long wait, process start can take time 34 | bool b = reply.WaitOne(10000); 35 | reply.Reset(); 36 | 37 | return b; 38 | } 39 | 40 | public bool Receive(ref String s, int timeout = 1000) 41 | { 42 | if (!ask.WaitOne(timeout)) 43 | return false; 44 | 45 | using (MemoryMappedViewStream stream = mmf.CreateViewStream()) 46 | { 47 | byte[] buf = new byte[8]; 48 | stream.Read(buf, 0, 4); 49 | int l = BitConverter.ToInt32(buf, 0); 50 | buf = new byte[l]; 51 | stream.Read(buf, 0, l); 52 | s = Encoding.UTF8.GetString(buf); 53 | } 54 | 55 | reply.Set(); 56 | ask.Reset(); 57 | return true; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /ScriptEngineStarter/IpcChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO.MemoryMappedFiles; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | public class IpcChannel 10 | { 11 | EventWaitHandle ask; 12 | EventWaitHandle reply; 13 | MemoryMappedFile mmf; 14 | 15 | public IpcChannel(int processId) 16 | { 17 | ask = new EventWaitHandle(false, EventResetMode.ManualReset, "ask_Scripter_IpcChannel_" + processId); 18 | reply = new EventWaitHandle(false, EventResetMode.ManualReset, "reply_Scripter_IpcChannel_" + processId); 19 | mmf = MemoryMappedFile.CreateOrOpen("Scripter_IpcChannel_" + processId, 1000); 20 | } 21 | 22 | public bool Send(String msg) 23 | { 24 | using (MemoryMappedViewStream stream = mmf.CreateViewStream()) 25 | { 26 | byte[] buf = Encoding.UTF8.GetBytes(msg); 27 | byte[] bufLen = BitConverter.GetBytes(buf.Length); 28 | stream.Write(bufLen, 0, bufLen.Length); 29 | stream.Write(buf, 0, buf.Length); 30 | } 31 | ask.Set(); 32 | 33 | // Really long wait, process start can take time 34 | bool b = reply.WaitOne(60000); 35 | reply.Reset(); 36 | 37 | return b; 38 | } 39 | 40 | public bool Receive(ref String s, int timeout = 1000) 41 | { 42 | if (!ask.WaitOne(timeout)) 43 | return false; 44 | 45 | using (MemoryMappedViewStream stream = mmf.CreateViewStream()) 46 | { 47 | byte[] buf = new byte[8]; 48 | stream.Read(buf, 0, 4); 49 | int l = BitConverter.ToInt32(buf, 0); 50 | buf = new byte[l]; 51 | stream.Read(buf, 0, l); 52 | s = Encoding.UTF8.GetString(buf); 53 | } 54 | 55 | reply.Set(); 56 | ask.Reset(); 57 | return true; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /VSSyncProj/VSSyncProj.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSSyncProj", "VSSyncProj.csproj", "{199B8984-5F31-4E46-94C7-20CAA33081AF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|x64.ActiveCfg = Debug|Any CPU 21 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|x64.Build.0 = Debug|Any CPU 22 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|x86.ActiveCfg = Debug|Any CPU 23 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|x86.Build.0 = Debug|Any CPU 24 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|x64.ActiveCfg = Release|Any CPU 27 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|x64.Build.0 = Release|Any CPU 28 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|x86.ActiveCfg = Release|Any CPU 29 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|x86.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {E8A88010-5278-45CD-B8AA-E8AB6B2896B1} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /SolutionProjectModel/helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #ifdef SPM_EXPORT 7 | #define SPM_DLLEXPORT __declspec(dllexport) 8 | #else 9 | #define SPM_DLLEXPORT __declspec(dllimport) 10 | #endif 11 | 12 | 13 | template 14 | std::basic_string svaFormat(const T* format, va_list args) 15 | { 16 | int size; 17 | 18 | if constexpr (std::is_same_v) 19 | size = vsnprintf(nullptr, 0, format, args); 20 | else 21 | size = _vsnwprintf(nullptr, 0, format, args); 22 | 23 | size++; // Zero termination 24 | std::basic_string s; 25 | s.resize(size); 26 | 27 | if constexpr (std::is_same_v) 28 | vsnprintf(&s[0], size, format, args); 29 | else 30 | _vsnwprintf(&s[0], size, format, args); 31 | 32 | return s; 33 | } 34 | 35 | // 36 | // Formats string/wstring according to format, if formatting fails (e.g. invalid %s pointer - returns empty string) 37 | // 38 | template 39 | std::basic_string sFormat(const T* format, ...) 40 | { 41 | va_list args; 42 | va_start(args, format); 43 | return svaFormat(format, args); 44 | } 45 | 46 | void SPM_DLLEXPORT throwFormat(const char* format, ...); 47 | 48 | std::string SPM_DLLEXPORT GetLastErrorMessageA( DWORD code = GetLastError() ); 49 | 50 | void SPM_DLLEXPORT ThrowLastError( DWORD code = GetLastError() ); 51 | 52 | int SPM_DLLEXPORT ExecCmd( const wchar_t* cmd ); 53 | 54 | // 55 | // Lowercases string 56 | // 57 | template 58 | std::basic_string lowercase(const std::basic_string& s) 59 | { 60 | std::basic_string s2 = s; 61 | std::transform(s2.begin(), s2.end(), s2.begin(), tolower); 62 | return std::move(s2); 63 | } 64 | 65 | // 66 | // Uppercases string 67 | // 68 | template 69 | std::basic_string uppercase(const std::basic_string& s) 70 | { 71 | std::basic_string s2 = s; 72 | std::transform(s2.begin(), s2.end(), s2.begin(), toupper); 73 | return std::move(s2); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or real) 9 | // concrete implementation should override the sink_it_() and flush_() methods. 10 | // locking is taken care of in this class - no locking needed by the 11 | // implementers.. 12 | // 13 | 14 | #include "spdlog/common.h" 15 | #include "spdlog/details/log_msg.h" 16 | #include "spdlog/formatter.h" 17 | #include "spdlog/sinks/sink.h" 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | template 22 | class base_sink : public sink 23 | { 24 | public: 25 | base_sink() = default; 26 | base_sink(const base_sink &) = delete; 27 | base_sink &operator=(const base_sink &) = delete; 28 | 29 | void log(const details::log_msg &msg) final 30 | { 31 | std::lock_guard lock(mutex_); 32 | sink_it_(msg); 33 | } 34 | 35 | void flush() final 36 | { 37 | std::lock_guard lock(mutex_); 38 | flush_(); 39 | } 40 | 41 | void set_pattern(const std::string &pattern) final 42 | { 43 | std::lock_guard lock(mutex_); 44 | set_pattern_(pattern); 45 | } 46 | 47 | void set_formatter(std::unique_ptr sink_formatter) final 48 | { 49 | std::lock_guard lock(mutex_); 50 | set_formatter_(std::move(sink_formatter)); 51 | } 52 | 53 | protected: 54 | virtual void sink_it_(const details::log_msg &msg) = 0; 55 | virtual void flush_() = 0; 56 | 57 | virtual void set_pattern_(const std::string &pattern) 58 | { 59 | set_formatter_(details::make_unique(pattern)); 60 | } 61 | 62 | virtual void set_formatter_(std::unique_ptr sink_formatter) 63 | { 64 | formatter_ = std::move(sink_formatter); 65 | } 66 | Mutex mutex_; 67 | }; 68 | } // namespace sinks 69 | } // namespace spdlog 70 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/stdout_color_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2018 spdlog 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #ifdef _WIN32 13 | #include "spdlog/sinks/wincolor_sink.h" 14 | #else 15 | #include "spdlog/sinks/ansicolor_sink.h" 16 | #endif 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | #ifdef _WIN32 21 | using stdout_color_sink_mt = wincolor_stdout_sink_mt; 22 | using stdout_color_sink_st = wincolor_stdout_sink_st; 23 | using stderr_color_sink_mt = wincolor_stderr_sink_mt; 24 | using stderr_color_sink_st = wincolor_stderr_sink_st; 25 | #else 26 | using stdout_color_sink_mt = ansicolor_stdout_sink_mt; 27 | using stdout_color_sink_st = ansicolor_stdout_sink_st; 28 | using stderr_color_sink_mt = ansicolor_stderr_sink_mt; 29 | using stderr_color_sink_st = ansicolor_stderr_sink_st; 30 | #endif 31 | } // namespace sinks 32 | 33 | template 34 | inline std::shared_ptr stdout_color_mt(const std::string &logger_name, color_mode mode = color_mode::automatic) 35 | { 36 | return Factory::template create(logger_name, mode); 37 | } 38 | 39 | template 40 | inline std::shared_ptr stdout_color_st(const std::string &logger_name, color_mode mode = color_mode::automatic) 41 | { 42 | return Factory::template create(logger_name, mode); 43 | } 44 | 45 | template 46 | inline std::shared_ptr stderr_color_mt(const std::string &logger_name, color_mode mode = color_mode::automatic) 47 | { 48 | return Factory::template create(logger_name, mode); 49 | } 50 | 51 | template 52 | inline std::shared_ptr stderr_color_st(const std::string &logger_name, color_mode mode = color_mode::automatic) 53 | { 54 | return Factory::template create(logger_name, mode); 55 | } 56 | } // namespace spdlog 57 | -------------------------------------------------------------------------------- /SolutionProjectModel/SolutionProjectModel.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SolutionProjectModel", "SolutionProjectModel.vcxproj", "{D44945D6-4DED-4434-91D7-2B812537DF6E}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testCppApp", "testCppApp.vcxproj", "{74657374-4370-7041-7070-000000000000}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppexec", "cppexec\cppexec.vcxproj", "{DB52F66D-D0A9-4A5F-9EA4-9F08CEA33BD7}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {D44945D6-4DED-4434-91D7-2B812537DF6E}.Debug|x64.ActiveCfg = Debug|x64 19 | {D44945D6-4DED-4434-91D7-2B812537DF6E}.Debug|x64.Build.0 = Debug|x64 20 | {D44945D6-4DED-4434-91D7-2B812537DF6E}.Release|x64.ActiveCfg = Release|x64 21 | {D44945D6-4DED-4434-91D7-2B812537DF6E}.Release|x64.Build.0 = Release|x64 22 | {74657374-4370-7041-7070-000000000000}.Debug|x64.ActiveCfg = Debug|x64 23 | {74657374-4370-7041-7070-000000000000}.Debug|x64.Build.0 = Debug|x64 24 | {74657374-4370-7041-7070-000000000000}.Release|x64.ActiveCfg = Release|x64 25 | {74657374-4370-7041-7070-000000000000}.Release|x64.Build.0 = Release|x64 26 | {DB52F66D-D0A9-4A5F-9EA4-9F08CEA33BD7}.Debug|x64.ActiveCfg = Debug|x64 27 | {DB52F66D-D0A9-4A5F-9EA4-9F08CEA33BD7}.Debug|x64.Build.0 = Debug|x64 28 | {DB52F66D-D0A9-4A5F-9EA4-9F08CEA33BD7}.Release|x64.ActiveCfg = Release|x64 29 | {DB52F66D-D0A9-4A5F-9EA4-9F08CEA33BD7}.Release|x64.Build.0 = Release|x64 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {943953D8-3DE8-4B11-B84F-8584136E340B} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /Tools/vsDev/vsDev2.cs: -------------------------------------------------------------------------------- 1 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.15.0.15.0.26228\lib\Microsoft.VisualStudio.Shell.15.0.dll 2 | //css_ref C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\EnvDTE80.dll 3 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\bin\Debug\ScriptEngine.dll 4 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll 5 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll 6 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 7 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 8 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll 9 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.25407\lib\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll 10 | //css_ref \Prototyping\cppscriptcore\ScriptEngine\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26228\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll 11 | //css_ref C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\EnvDTE.dll 12 | //css_ref C:\Prototyping\cppscriptcore\bin\ScriptEngineStarter.exe 13 | using EnvDTE; 14 | using EnvDTE80; 15 | using Microsoft.VisualStudio.Shell; 16 | using ScriptEngine; 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Diagnostics; 20 | using System.IO; 21 | using System.Linq; 22 | using System.Reflection; 23 | using System.Text; 24 | using System.Threading.Tasks; 25 | 26 | public class vsDev2 27 | { 28 | public static async void Main( object arg ) 29 | { 30 | Debug.WriteLine("Started ok."); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Tools/vsStart/vsStart_vs2019.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28407.52 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vsStart_vs2019", "vsStart_vs2019.csproj", "{BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vsDev", "..\vsDev\vsDev.csproj", "{3DA82FA0-F46B-482E-9F79-358DA1EEDC71}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSSyncProj_vs2019", "..\..\VSSyncProj\VSSyncProj_vs2019.csproj", "{199B8984-5F31-4E46-94C7-20CAA33081AF}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {199B8984-5F31-4E46-94C7-20CAA33081AF}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | GlobalSection(ExtensibilityGlobals) = postSolution 34 | SolutionGuid = {03776DE8-0917-4BC0-8620-A89A6B5314D2} 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/periodic_worker.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #pragma once 8 | 9 | // periodic worker thread - periodically executes the given callback function. 10 | // 11 | // RAII over the owned thread: 12 | // creates the thread on construction. 13 | // stops and joins the thread on destruction (if the thread is executing a callback, wait for it to finish first). 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | namespace spdlog { 21 | namespace details { 22 | 23 | class periodic_worker 24 | { 25 | public: 26 | periodic_worker(const std::function &callback_fun, std::chrono::seconds interval) 27 | { 28 | active_ = (interval > std::chrono::seconds::zero()); 29 | if (!active_) 30 | { 31 | return; 32 | } 33 | 34 | worker_thread_ = std::thread([this, callback_fun, interval]() { 35 | for (;;) 36 | { 37 | std::unique_lock lock(this->mutex_); 38 | if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) 39 | { 40 | return; // active_ == false, so exit this thread 41 | } 42 | callback_fun(); 43 | } 44 | }); 45 | } 46 | 47 | periodic_worker(const periodic_worker &) = delete; 48 | periodic_worker &operator=(const periodic_worker &) = delete; 49 | 50 | // stop the worker thread and join it 51 | ~periodic_worker() 52 | { 53 | if (worker_thread_.joinable()) 54 | { 55 | { 56 | std::lock_guard lock(mutex_); 57 | active_ = false; 58 | } 59 | cv_.notify_one(); 60 | worker_thread_.join(); 61 | } 62 | } 63 | 64 | private: 65 | bool active_; 66 | std::thread worker_thread_; 67 | std::mutex mutex_; 68 | std::condition_variable cv_; 69 | }; 70 | } // namespace details 71 | } // namespace spdlog 72 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/basic_file_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015-2018 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/file_helper.h" 13 | #include "spdlog/details/null_mutex.h" 14 | #include "spdlog/sinks/base_sink.h" 15 | 16 | #include 17 | #include 18 | 19 | namespace spdlog { 20 | namespace sinks { 21 | /* 22 | * Trivial file sink with single file as target 23 | */ 24 | template 25 | class basic_file_sink final : public base_sink 26 | { 27 | public: 28 | explicit basic_file_sink(const filename_t &filename, bool truncate = false) 29 | { 30 | file_helper_.open(filename, truncate); 31 | } 32 | 33 | const filename_t &filename() const 34 | { 35 | return file_helper_.filename(); 36 | } 37 | 38 | protected: 39 | void sink_it_(const details::log_msg &msg) override 40 | { 41 | fmt::memory_buffer formatted; 42 | sink::formatter_->format(msg, formatted); 43 | file_helper_.write(formatted); 44 | } 45 | 46 | void flush_() override 47 | { 48 | file_helper_.flush(); 49 | } 50 | 51 | private: 52 | details::file_helper file_helper_; 53 | }; 54 | 55 | using basic_file_sink_mt = basic_file_sink; 56 | using basic_file_sink_st = basic_file_sink; 57 | 58 | } // namespace sinks 59 | 60 | // 61 | // factory functions 62 | // 63 | template 64 | inline std::shared_ptr basic_logger_mt(const std::string &logger_name, const filename_t &filename, bool truncate = false) 65 | { 66 | return Factory::template create(logger_name, filename, truncate); 67 | } 68 | 69 | template 70 | inline std::shared_ptr basic_logger_st(const std::string &logger_name, const filename_t &filename, bool truncate = false) 71 | { 72 | return Factory::template create(logger_name, filename, truncate); 73 | } 74 | 75 | } // namespace spdlog 76 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /Test/ClassLibrary1/ClassLibrary1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8E97B0D6-C716-4D7C-B497-9BD09CCE528E} 8 | Library 9 | Properties 10 | ClassLibrary1 11 | ClassLibrary1 12 | v4.7.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\bin\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\..\bin\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Test/ClassLibrary2/ClassLibrary2.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CDD46471-5368-480D-90B1-7679D051562E} 8 | Library 9 | Properties 10 | ClassLibrary2 11 | ClassLibrary2 12 | v4.7.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | ..\..\bin\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | ..\..\bin\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ScriptEngine/ScriptEnginePackage.vsct: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /VSSyncProj/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ScriptEngine/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/async_logger.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Very fast asynchronous logger (millions of logs per second on an average 9 | // desktop) 10 | // Uses pre allocated lockfree queue for maximum throughput even under large 11 | // number of threads. 12 | // Creates a single back thread to pop messages from the queue and log them. 13 | // 14 | // Upon each log write the logger: 15 | // 1. Checks if its log level is enough to log the message 16 | // 2. Push a new copy of the message to a queue (or block the caller until 17 | // space is available in the queue) 18 | // 3. will throw spdlog_ex upon log exceptions 19 | // Upon destruction, logs all remaining messages in the queue before 20 | // destructing.. 21 | 22 | #include "spdlog/common.h" 23 | #include "spdlog/logger.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace spdlog { 30 | 31 | // Async overflow policy - block by default. 32 | enum class async_overflow_policy 33 | { 34 | block, // Block until message can be enqueued 35 | overrun_oldest // Discard oldest message in the queue if full when trying to 36 | // add new item. 37 | }; 38 | 39 | namespace details { 40 | class thread_pool; 41 | } 42 | 43 | class async_logger final : public std::enable_shared_from_this, public logger 44 | { 45 | friend class details::thread_pool; 46 | 47 | public: 48 | template 49 | async_logger(std::string logger_name, It begin, It end, std::weak_ptr tp, 50 | async_overflow_policy overflow_policy = async_overflow_policy::block); 51 | 52 | async_logger(std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, 53 | async_overflow_policy overflow_policy = async_overflow_policy::block); 54 | 55 | async_logger(std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, 56 | async_overflow_policy overflow_policy = async_overflow_policy::block); 57 | 58 | std::shared_ptr clone(std::string new_name) override; 59 | 60 | protected: 61 | void sink_it_(details::log_msg &msg) override; 62 | void flush_() override; 63 | 64 | void backend_log_(const details::log_msg &incoming_log_msg); 65 | void backend_flush_(); 66 | 67 | private: 68 | std::weak_ptr thread_pool_; 69 | async_overflow_policy overflow_policy_; 70 | }; 71 | } // namespace spdlog 72 | 73 | #include "details/async_logger_impl.h" 74 | -------------------------------------------------------------------------------- /SolutionProjectModel/VisualStudioInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "VisualStudioInfo.h" 3 | #include //DWORD 4 | #include //function 5 | #include //CW2A 6 | #include //_COM_SMARTPTR_TYPEDEF 7 | #include 8 | 9 | _COM_SMARTPTR_TYPEDEF(ISetupConfiguration, __uuidof(ISetupConfiguration)); 10 | _COM_SMARTPTR_TYPEDEF(IEnumSetupInstances, __uuidof(IEnumSetupInstances)); 11 | _COM_SMARTPTR_TYPEDEF(ISetupInstance, __uuidof(ISetupInstance)); 12 | _COM_SMARTPTR_TYPEDEF(ISetupInstanceCatalog, __uuidof(ISetupInstanceCatalog)); 13 | _COM_SMARTPTR_TYPEDEF(ISetupPropertyStore, __uuidof(ISetupPropertyStore)); 14 | 15 | using namespace std; 16 | 17 | 18 | vector getInstalledVisualStudios(void) 19 | { 20 | vector instances; 21 | // Idea copied from vswhere, except whole implementation was re-written from scratch. 22 | { 23 | ISetupConfigurationPtr setupCfg; 24 | IEnumSetupInstancesPtr enumInstances; 25 | 26 | auto lcid = GetUserDefaultLCID(); 27 | 28 | function hrc = [](HRESULT hr) 29 | { 30 | if (FAILED(hr)) 31 | { 32 | USES_CONVERSION; 33 | throw exception(CW2A(_com_error(hr).ErrorMessage())); 34 | } 35 | }; 36 | 37 | hrc(CoInitialize(nullptr)); 38 | hrc(setupCfg.CreateInstance(__uuidof(SetupConfiguration))); 39 | hrc(setupCfg->EnumInstances(&enumInstances)); 40 | 41 | while (true) 42 | { 43 | ISetupInstance* p = nullptr; 44 | unsigned long ul = 0; 45 | HRESULT hr = enumInstances->Next(1, &p, &ul); 46 | if (hr != S_OK) 47 | break; 48 | 49 | ISetupInstancePtr setupi(p, false); 50 | ISetupInstanceCatalogPtr instanceCatalog; 51 | ISetupPropertyStorePtr store; 52 | hrc(setupi->QueryInterface(&instanceCatalog)); 53 | hrc(instanceCatalog->GetCatalogInfo(&store)); 54 | 55 | CComVariant v; 56 | hrc(store->GetValue(L"productLineVersion", &v)); 57 | 58 | VisualStudioInfo vsinfo; 59 | vsinfo.version = atoi(CStringA(v).GetBuffer()); 60 | CComBSTR instpath; 61 | // GetDisplayName can be used to get name of instance. 62 | hrc(setupi->GetInstallationPath(&instpath)); 63 | vsinfo.InstallPath = instpath; 64 | instances.push_back(vsinfo); 65 | } 66 | } 67 | CoUninitialize(); 68 | 69 | return instances; 70 | } 71 | 72 | 73 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/dist_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 David Schury, Gabi Melman 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "base_sink.h" 13 | #include "spdlog/details/log_msg.h" 14 | #include "spdlog/details/null_mutex.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | // Distribution sink (mux). Stores a vector of sinks which get called when log 22 | // is called 23 | 24 | namespace spdlog { 25 | namespace sinks { 26 | 27 | template 28 | class dist_sink : public base_sink 29 | { 30 | public: 31 | dist_sink() = default; 32 | dist_sink(const dist_sink &) = delete; 33 | dist_sink &operator=(const dist_sink &) = delete; 34 | 35 | void add_sink(std::shared_ptr sink) 36 | { 37 | std::lock_guard lock(base_sink::mutex_); 38 | sinks_.push_back(sink); 39 | } 40 | 41 | void remove_sink(std::shared_ptr sink) 42 | { 43 | std::lock_guard lock(base_sink::mutex_); 44 | sinks_.erase(std::remove(sinks_.begin(), sinks_.end(), sink), sinks_.end()); 45 | } 46 | 47 | void set_sinks(std::vector> sinks) 48 | { 49 | std::lock_guard lock(base_sink::mutex_); 50 | sinks_ = std::move(sinks); 51 | } 52 | 53 | protected: 54 | void sink_it_(const details::log_msg &msg) override 55 | { 56 | 57 | for (auto &sink : sinks_) 58 | { 59 | if (sink->should_log(msg.level)) 60 | { 61 | sink->log(msg); 62 | } 63 | } 64 | } 65 | 66 | void flush_() override 67 | { 68 | for (auto &sink : sinks_) 69 | { 70 | sink->flush(); 71 | } 72 | } 73 | 74 | void set_pattern_(const std::string &pattern) override 75 | { 76 | set_formatter_(details::make_unique(pattern)); 77 | } 78 | 79 | void set_formatter_(std::unique_ptr sink_formatter) override 80 | { 81 | base_sink::formatter_ = std::move(sink_formatter); 82 | for (auto &sink : sinks_) 83 | { 84 | sink->set_formatter(base_sink::formatter_->clone()); 85 | } 86 | } 87 | std::vector> sinks_; 88 | }; 89 | 90 | using dist_sink_mt = dist_sink; 91 | using dist_sink_st = dist_sink; 92 | 93 | } // namespace sinks 94 | } // namespace spdlog 95 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/systemd_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2019 ZVYAGIN.Alexander@gmail.com 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/sinks/base_sink.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | 21 | inline int syslog_level(level::level_enum l) { 22 | switch(l) { 23 | case level::off: 24 | case level::trace: 25 | case level::debug: 26 | return LOG_DEBUG; 27 | case level::info: 28 | return LOG_INFO; 29 | case level::warn: 30 | return LOG_WARNING; 31 | case level::err: 32 | return LOG_ERR; 33 | case level::critical: 34 | return LOG_CRIT; 35 | default: 36 | throw std::invalid_argument("systemd_sink.h syslog_level()"); 37 | } 38 | } 39 | 40 | /** 41 | * Sink that write to systemd using the `sd_journal_print()` library call. 42 | * 43 | * Locking is not needed, as `sd_journal_print()` itself is thread-safe. 44 | */ 45 | template 46 | class systemd_sink : public base_sink 47 | { 48 | public: 49 | // 50 | explicit systemd_sink(void) {} 51 | 52 | ~systemd_sink() override {} 53 | 54 | systemd_sink(const systemd_sink &) = delete; 55 | systemd_sink &operator=(const systemd_sink &) = delete; 56 | 57 | protected: 58 | void sink_it_(const details::log_msg &msg) override 59 | { 60 | if( sd_journal_print( 61 | syslog_level(msg.level), 62 | "%.*s", 63 | static_cast(msg.payload.size()), 64 | msg.payload.data() 65 | ) 66 | ) 67 | throw spdlog_ex("Failed writing to systemd"); 68 | } 69 | 70 | void flush_() override {} 71 | }; 72 | 73 | using systemd_sink_mt = systemd_sink; 74 | using systemd_sink_st = systemd_sink; 75 | } // namespace sinks 76 | 77 | // Create and register a syslog logger 78 | template 79 | inline std::shared_ptr systemd_logger_mt( 80 | const std::string &logger_name) 81 | { 82 | return Factory::template create(logger_name); 83 | } 84 | 85 | template 86 | inline std::shared_ptr systemd_logger_st( 87 | const std::string &logger_name) 88 | { 89 | return Factory::template create(logger_name); 90 | } 91 | } // namespace spdlog 92 | -------------------------------------------------------------------------------- /Tools/vsStart/MessageFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | /// 5 | /// See https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/ms228772(v=vs.100) 6 | /// 7 | public class MessageFilter : IOleMessageFilter 8 | { 9 | // 10 | // Class containing the IOleMessageFilter 11 | // thread error-handling functions. 12 | 13 | // Start the filter. 14 | public static void Register() 15 | { 16 | IOleMessageFilter newFilter = new MessageFilter(); 17 | IOleMessageFilter oldFilter = null; 18 | CoRegisterMessageFilter(newFilter, out oldFilter); 19 | } 20 | 21 | // Done with the filter, close it. 22 | public static void Revoke() 23 | { 24 | IOleMessageFilter oldFilter = null; 25 | CoRegisterMessageFilter(null, out oldFilter); 26 | } 27 | 28 | // 29 | // IOleMessageFilter functions. 30 | // Handle incoming thread requests. 31 | int IOleMessageFilter.HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo) 32 | { 33 | //Return the flag SERVERCALL_ISHANDLED. 34 | return 0; 35 | } 36 | 37 | // Thread call was rejected, so try again. 38 | int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType) 39 | { 40 | if (dwRejectType == 2) 41 | // flag = SERVERCALL_RETRYLATER. 42 | { 43 | // Retry the thread call immediately if return >=0 & 44 | // <100. 45 | return 99; 46 | } 47 | // Too busy; cancel call. 48 | return -1; 49 | } 50 | 51 | int IOleMessageFilter.MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType) 52 | { 53 | //Return the flag PENDINGMSG_WAITDEFPROCESS. 54 | return 2; 55 | } 56 | 57 | // Implement the IOleMessageFilter interface. 58 | [DllImport("Ole32.dll")] 59 | private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter); 60 | } 61 | 62 | [ComImport(), Guid("00000016-0000-0000-C000-000000000046"), 63 | InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] 64 | interface IOleMessageFilter 65 | { 66 | [PreserveSig] 67 | int HandleInComingCall( int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo); 68 | 69 | [PreserveSig] 70 | int RetryRejectedCall( IntPtr hTaskCallee, int dwTickCount, int dwRejectType); 71 | 72 | [PreserveSig] 73 | int MessagePending( IntPtr hTaskCallee, int dwTickCount, int dwPendingType); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Tools/VSModelSync/CodeBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | public class CodeBuilder 8 | { 9 | StringBuilder sb = new StringBuilder(); 10 | String currentIndent = ""; 11 | Dictionary userData; 12 | 13 | /// 14 | /// User defined data accociated with container. 15 | /// 16 | public Dictionary UserData 17 | { 18 | get { 19 | if (userData == null) 20 | userData = new Dictionary(); 21 | 22 | return userData; 23 | } 24 | } 25 | 26 | public T GetUserData(String s) where T: class 27 | { 28 | var ud = UserData; 29 | Object o; 30 | if (!ud.ContainsKey(s)) 31 | ud.Add(s, default(T)); 32 | 33 | o = ud[s]; 34 | return o as T; 35 | } 36 | 37 | public CodeBuilder SetUserData(String k, Object v) 38 | { 39 | var ud = UserData; 40 | if (ud.ContainsKey(k)) 41 | ud[k] = v; 42 | else 43 | ud.Add(k, v); 44 | 45 | return this; 46 | } 47 | 48 | public int IndentValue() 49 | { 50 | return currentIndent.Length / 4; 51 | } 52 | 53 | public String IndentString 54 | { 55 | get { 56 | return currentIndent; 57 | } 58 | } 59 | 60 | /// 61 | /// Adds amount of indentation of each line. 62 | /// 63 | /// Amount of indents to add (positive) or remove (negative) 64 | public CodeBuilder Indent(int amount = 1) 65 | { 66 | int newIdent = (currentIndent.Length / 4) + amount; 67 | if (newIdent < 0) 68 | newIdent = 0; 69 | 70 | currentIndent = "".PadLeft(newIdent * 4, ' '); 71 | return this; 72 | } 73 | 74 | public CodeBuilder UnIndent(int amount = 1) 75 | { 76 | return Indent(-amount); 77 | } 78 | 79 | 80 | public CodeBuilder Append(T value) 81 | { 82 | sb.Append(value); 83 | return this; 84 | } 85 | 86 | public CodeBuilder AppendLine(string value) 87 | { 88 | sb.Append(currentIndent); 89 | sb.AppendLine(value); 90 | return this; 91 | } 92 | 93 | public CodeBuilder AppendLine() 94 | { 95 | sb.AppendLine(); 96 | return this; 97 | } 98 | 99 | public override string ToString() 100 | { 101 | return sb.ToString(); 102 | } 103 | 104 | } 105 | 106 | 107 | -------------------------------------------------------------------------------- /ScriptEngine/ScriptEngine.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEngine", "ScriptEngine.csproj", "{59014679-B59A-4CBB-970C-A4BCF585DB5D}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vsStart_vs2017", "..\Tools\vsStart\vsStart_vs2017.csproj", "{BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vsDev", "..\Tools\vsDev\vsDev.csproj", "{3DA82FA0-F46B-482E-9F79-358DA1EEDC71}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEngineStarter", "..\ScriptEngineStarter\ScriptEngineStarter.csproj", "{AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {59014679-B59A-4CBB-970C-A4BCF585DB5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {59014679-B59A-4CBB-970C-A4BCF585DB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {59014679-B59A-4CBB-970C-A4BCF585DB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {59014679-B59A-4CBB-970C-A4BCF585DB5D}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {BAF1C089-BBDD-46F5-AF47-8D4D2FA14D90}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {3DA82FA0-F46B-482E-9F79-358DA1EEDC71}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {DF8F5EB0-9C8D-4F0C-8446-3D4E033BB0C8} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /ScriptEngineStarter/VsScriptExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using EnvDTE80; 3 | using Microsoft.VisualStudio.Shell; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | using System.Linq; 8 | using System.Reflection; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | /// 13 | /// Handles errors coming from C# script compilation. 14 | /// 15 | public class VsScriptExceptionHandler : ScriptConsole 16 | { 17 | DTE2 GetDTE() 18 | { 19 | DTE2 dte = ScriptHost.mainArg.GetType().GetField("dte").GetValue(ScriptHost.mainArg) as DTE2; 20 | return dte; 21 | } 22 | 23 | OutputWindowPane GetOutputPanel() 24 | { 25 | OutputWindowPanes panes = GetDTE().ToolWindows.OutputWindow.OutputWindowPanes; 26 | OutputWindowPane pane; 27 | String cppScript = "Script Engine"; 28 | try 29 | { 30 | pane = panes.Item(cppScript); 31 | } 32 | catch (ArgumentException) 33 | { 34 | pane = panes.Add(cppScript); 35 | } 36 | 37 | return pane; 38 | } 39 | 40 | 41 | public override void ReportScriptResult(String file, Exception ex) 42 | { 43 | //Debug.WriteLine("Started from: " + Assembly.GetExecutingAssembly().FullName); 44 | ErrorListProvider errList = ScriptHost.GetUserObject(ScriptHost.mainArg); 45 | 46 | var dte = GetDTE(); 47 | var pane = GetOutputPanel(); 48 | pane.Clear(); 49 | 50 | String msg; 51 | if (ex != null) 52 | { 53 | msg = ex.Message.ToString(); 54 | 55 | // Just in case if developer is intrested to fix this. 56 | Debug.WriteLine(msg); 57 | 58 | // Bring into front in case of errors, otherwise don't activate window 59 | dte.ToolWindows.OutputWindow.Parent.AutoHides = false; 60 | dte.ToolWindows.OutputWindow.Parent.Activate(); 61 | } 62 | else 63 | { 64 | msg = file + "(1): info: compiled & executed successfully\r\n"; 65 | } 66 | 67 | pane.OutputString(msg); 68 | pane.Activate(); 69 | } 70 | 71 | 72 | public override void WriteLine(string msg = "") 73 | { 74 | var pane = GetOutputPanel(); 75 | 76 | var dte = GetDTE(); 77 | // Bring into front in case of errors, otherwise don't activate window 78 | dte.ToolWindows.OutputWindow.Parent.AutoHides = false; 79 | dte.ToolWindows.OutputWindow.Parent.Activate(); 80 | 81 | pane.OutputString(msg + "\n"); 82 | pane.Activate(); 83 | } 84 | 85 | public override void Clear() 86 | { 87 | GetOutputPanel().Clear(); 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Testing and Mocking Framework definitions useful in production code. 32 | // GOOGLETEST_CM0003 DO NOT DELETE 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void PrivateMethod(); 44 | // FRIEND_TEST(MyClassTest, PrivateMethodWorks); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, PrivateMethodWorks) { 52 | // // Can call MyClass::PrivateMethod() here. 53 | // } 54 | // 55 | // Note: The test class must be in the same namespace as the class being tested. 56 | // For example, putting MyClassTest in an anonymous namespace will not work. 57 | 58 | #define FRIEND_TEST(test_case_name, test_name)\ 59 | friend class test_case_name##_##test_name##_Test 60 | 61 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 62 | -------------------------------------------------------------------------------- /Tools/VSModelSync/VSModelSync.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {366F2418-4F65-4AF5-AEFB-0F3A40F1F4E3} 8 | Exe 9 | VSModelSync 10 | VSModelSync 11 | v4.5.1 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | $(ProjectDir)..\..\bin\ 22 | $(ProjectDir)..\..\obj\$(MSBuildProjectName)_$(Configuration)_$(Platform) 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | $(ProjectDir)..\..\bin\ 32 | $(ProjectDir)..\..\obj\$(MSBuildProjectName)_$(Configuration)_$(Platform) 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Test/testScript/testScript2.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C7CE591C-160E-4811-BEAA-0955EDCADCB2} 8 | WinExe 9 | testScript2 10 | testScript2 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | ..\..\bin\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | ..\..\bin\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {aff313bd-8d4e-4eb7-93ee-e43b751bfd31} 54 | scriptStarter 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /pugixml/pugiconfig.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * pugixml parser - version 1.9 3 | * -------------------------------------------------------- 4 | * Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 5 | * Report bugs and download new versions at http://pugixml.org/ 6 | * 7 | * This library is distributed under the MIT License. See notice at the end 8 | * of this file. 9 | * 10 | * This work is based on the pugxml parser, which is: 11 | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) 12 | */ 13 | 14 | #ifndef HEADER_PUGICONFIG_HPP 15 | #define HEADER_PUGICONFIG_HPP 16 | 17 | // Uncomment this to enable wchar_t mode 18 | #define PUGIXML_WCHAR_MODE 19 | 20 | // Uncomment this to enable compact mode 21 | // #define PUGIXML_COMPACT 22 | 23 | // Uncomment this to disable XPath 24 | // #define PUGIXML_NO_XPATH 25 | 26 | // Uncomment this to disable STL 27 | // #define PUGIXML_NO_STL 28 | 29 | // Uncomment this to disable exceptions 30 | // #define PUGIXML_NO_EXCEPTIONS 31 | 32 | // Set this to control attributes for public classes/functions, i.e.: 33 | // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL 34 | // #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL 35 | // #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall 36 | // In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead 37 | 38 | // Tune these constants to adjust memory-related behavior 39 | // #define PUGIXML_MEMORY_PAGE_SIZE 32768 40 | // #define PUGIXML_MEMORY_OUTPUT_STACK 10240 41 | // #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096 42 | 43 | // Uncomment this to switch to header-only version 44 | // #define PUGIXML_HEADER_ONLY 45 | 46 | // Uncomment this to enable long long support 47 | // #define PUGIXML_HAS_LONG_LONG 48 | 49 | #endif 50 | 51 | /** 52 | * Copyright (c) 2006-2018 Arseny Kapoulkine 53 | * 54 | * Permission is hereby granted, free of charge, to any person 55 | * obtaining a copy of this software and associated documentation 56 | * files (the "Software"), to deal in the Software without 57 | * restriction, including without limitation the rights to use, 58 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 59 | * copies of the Software, and to permit persons to whom the 60 | * Software is furnished to do so, subject to the following 61 | * conditions: 62 | * 63 | * The above copyright notice and this permission notice shall be 64 | * included in all copies or substantial portions of the Software. 65 | * 66 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 67 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 68 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 69 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 70 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 71 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 72 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 73 | * OTHER DEALINGS IN THE SOFTWARE. 74 | */ 75 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/fmt/bundled/locale.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - std::locale support 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #ifndef FMT_LOCALE_H_ 9 | #define FMT_LOCALE_H_ 10 | 11 | #include "format.h" 12 | #include 13 | 14 | FMT_BEGIN_NAMESPACE 15 | 16 | namespace internal { 17 | template 18 | typename buffer_context::type::iterator vformat_to( 19 | const std::locale &loc, basic_buffer &buf, 20 | basic_string_view format_str, 21 | basic_format_args::type> args) { 22 | typedef back_insert_range > range; 23 | return vformat_to>( 24 | buf, to_string_view(format_str), args, internal::locale_ref(loc)); 25 | } 26 | 27 | template 28 | std::basic_string vformat( 29 | const std::locale &loc, basic_string_view format_str, 30 | basic_format_args::type> args) { 31 | basic_memory_buffer buffer; 32 | internal::vformat_to(loc, buffer, format_str, args); 33 | return fmt::to_string(buffer); 34 | } 35 | } 36 | 37 | template 38 | inline std::basic_string vformat( 39 | const std::locale &loc, const S &format_str, 40 | basic_format_args::type> args) { 41 | return internal::vformat(loc, to_string_view(format_str), args); 42 | } 43 | 44 | template 45 | inline std::basic_string format( 46 | const std::locale &loc, const S &format_str, const Args &... args) { 47 | return internal::vformat( 48 | loc, to_string_view(format_str), 49 | *internal::checked_args(format_str, args...)); 50 | } 51 | 52 | template 53 | inline typename std::enable_if::value, 54 | OutputIt>::type 55 | vformat_to(OutputIt out, const std::locale &loc, const String &format_str, 56 | typename format_args_t::type args) { 57 | typedef output_range range; 58 | return vformat_to>( 59 | range(out), to_string_view(format_str), args, internal::locale_ref(loc)); 60 | } 61 | 62 | template 63 | inline typename std::enable_if< 64 | internal::is_string::value && 65 | internal::is_output_iterator::value, OutputIt>::type 66 | format_to(OutputIt out, const std::locale &loc, const S &format_str, 67 | const Args &... args) { 68 | internal::check_format_string(format_str); 69 | typedef typename format_context_t::type context; 70 | format_arg_store as{args...}; 71 | return vformat_to(out, loc, to_string_view(format_str), 72 | basic_format_args(as)); 73 | } 74 | 75 | FMT_END_NAMESPACE 76 | 77 | #endif // FMT_LOCALE_H_ 78 | -------------------------------------------------------------------------------- /CsScriptHotReload.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "scriptStarter", "scriptStarter\scriptStarter.csproj", "{AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testScript", "Test\testScript\testScript.csproj", "{5761F698-0F66-47B3-BFE7-883ACA64F513}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testScript2", "Test\testScript\testScript2.csproj", "{C7CE591C-160E-4811-BEAA-0955EDCADCB2}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "Test\ClassLibrary1\ClassLibrary1.csproj", "{8E97B0D6-C716-4D7C-B497-9BD09CCE528E}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary2", "Test\ClassLibrary2\ClassLibrary2.csproj", "{CDD46471-5368-480D-90B1-7679D051562E}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|x64 = Debug|x64 19 | Release|x64 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Debug|x64.ActiveCfg = Debug|Any CPU 23 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Debug|x64.Build.0 = Debug|Any CPU 24 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Release|x64.ActiveCfg = Release|Any CPU 25 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31}.Release|x64.Build.0 = Release|Any CPU 26 | {5761F698-0F66-47B3-BFE7-883ACA64F513}.Debug|x64.ActiveCfg = Debug|Any CPU 27 | {5761F698-0F66-47B3-BFE7-883ACA64F513}.Debug|x64.Build.0 = Debug|Any CPU 28 | {5761F698-0F66-47B3-BFE7-883ACA64F513}.Release|x64.ActiveCfg = Release|Any CPU 29 | {5761F698-0F66-47B3-BFE7-883ACA64F513}.Release|x64.Build.0 = Release|Any CPU 30 | {C7CE591C-160E-4811-BEAA-0955EDCADCB2}.Debug|x64.ActiveCfg = Debug|Any CPU 31 | {C7CE591C-160E-4811-BEAA-0955EDCADCB2}.Debug|x64.Build.0 = Debug|Any CPU 32 | {C7CE591C-160E-4811-BEAA-0955EDCADCB2}.Release|x64.ActiveCfg = Release|Any CPU 33 | {C7CE591C-160E-4811-BEAA-0955EDCADCB2}.Release|x64.Build.0 = Release|Any CPU 34 | {8E97B0D6-C716-4D7C-B497-9BD09CCE528E}.Debug|x64.ActiveCfg = Debug|Any CPU 35 | {8E97B0D6-C716-4D7C-B497-9BD09CCE528E}.Debug|x64.Build.0 = Debug|Any CPU 36 | {8E97B0D6-C716-4D7C-B497-9BD09CCE528E}.Release|x64.ActiveCfg = Release|Any CPU 37 | {8E97B0D6-C716-4D7C-B497-9BD09CCE528E}.Release|x64.Build.0 = Release|Any CPU 38 | {CDD46471-5368-480D-90B1-7679D051562E}.Debug|x64.ActiveCfg = Debug|Any CPU 39 | {CDD46471-5368-480D-90B1-7679D051562E}.Debug|x64.Build.0 = Debug|Any CPU 40 | {CDD46471-5368-480D-90B1-7679D051562E}.Release|x64.ActiveCfg = Release|Any CPU 41 | {CDD46471-5368-480D-90B1-7679D051562E}.Release|x64.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {03776DE8-0917-4BC0-8620-A89A6B5314D2} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /SolutionProjectModel/VCConfiguration.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "VCConfiguration.h" 3 | #include "Project.h" 4 | 5 | using namespace pugi; 6 | using namespace std; 7 | 8 | // 9 | // Copies value from path first step to xml node. 10 | // 11 | void ReflectCopyValue(ReflectPath& path, xml_node node) 12 | { 13 | ReflectPathStep& step = path.steps[0]; 14 | FieldInfo* fi = step.typeInfo->GetField(step.propertyName); 15 | CStringW value = fi->fieldType->ToString((char*)step.instance->ReflectGetInstance() + fi->offset); 16 | node.text().set(value); 17 | } 18 | 19 | // 20 | // Reconstructs xml path from our class structure to xml nodes. 21 | // 22 | void ReflectCopy(ReflectPath& path, xml_node toNode) 23 | { 24 | xml_node current = toNode; 25 | 26 | for (size_t i = path.steps.size(); i-- > 0; ) 27 | { 28 | ReflectPathStep& step = path.steps[i]; 29 | 30 | // Field map, which specified in which order fields should be. 0,1 ... and so on. 31 | auto&& mapFields = step.instance->mapFieldToIndex; 32 | 33 | if (step.instance->propertyName.length() == 0 && step.instance->GetParent() != nullptr) 34 | mapFields = step.instance->GetParent()->mapFieldToIndex; 35 | 36 | wstring name = as_wide(step.propertyName); 37 | xml_node next = current.child(name.c_str()); 38 | if (next.empty()) 39 | { 40 | int newNodeFieldIndex = mapFields[step.propertyName]; 41 | xml_node node = current.first_child(); 42 | xml_node insertBefore; 43 | 44 | for (; !node.empty(); node = node.next_sibling()) 45 | { 46 | int currentNodeFieldIndex = mapFields[as_utf8(node.name()).c_str()]; 47 | 48 | if (newNodeFieldIndex > currentNodeFieldIndex) 49 | continue; 50 | 51 | insertBefore = node; 52 | break; 53 | } 54 | 55 | if (insertBefore.empty()) 56 | next = current.append_child(name.c_str()); 57 | else 58 | next = current.insert_child_before(name.c_str(), insertBefore); 59 | } 60 | 61 | current = next; 62 | } 63 | 64 | ReflectCopyValue(path, current); 65 | } 66 | 67 | void VCConfiguration::OnAfterSetProperty(ReflectPath& path) 68 | { 69 | xml_node current; 70 | ReflectPathStep& lastStep = path.steps.back(); 71 | 72 | if (lastStep.typeInfo->name == "GeneralConf") 73 | { 74 | if (lastStep.typeInfo->GetField(lastStep.propertyName) - lastStep.typeInfo->GetField("ConfigurationType") >= 0) 75 | { 76 | current = pgConfigurationNode; 77 | } 78 | else 79 | { 80 | if (pgNode.empty()) 81 | pgNode = project->selectProjectNodes(L"PropertyGroup", L"", configurationName.c_str(), platform.c_str()); 82 | 83 | current = pgNode; 84 | } 85 | } 86 | else 87 | { 88 | if (idgConfNode.empty()) 89 | idgConfNode = project->selectProjectNodes(L"ItemDefinitionGroup", L"", configurationName.c_str(), platform.c_str()); 90 | 91 | current = idgConfNode; 92 | } 93 | 94 | ReflectCopy(path, current); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /ScriptEngine/ScriptEnginePackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Runtime.InteropServices; 5 | using System.Threading; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | using Microsoft.VisualStudio.Shell.Interop; 9 | using Task = System.Threading.Tasks.Task; 10 | 11 | namespace ScriptEngine 12 | { 13 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 14 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 15 | [Guid(ScriptEnginePackage.PackageGuid)] 16 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 17 | [ProvideMenuResource("Menus.ctmenu", 1)] 18 | 19 | // Auto load when starting up 20 | [ProvideAutoLoad(UIContextGuids80.NoSolution)] 21 | public sealed class ScriptEnginePackage : AsyncPackage 22 | { 23 | public const string PackageGuid = "dc06e809-f64c-49e4-b9d5-d6e6d60dee7c"; 24 | public static readonly Guid CommandSet = new Guid("6fd609b8-64f9-4636-a95b-d3322b87b185"); 25 | public const int CommandId = 0x0100; 26 | 27 | public dynamic vsModule; 28 | public DTE2 dte; 29 | public IVsSolution vsSolution; 30 | 31 | /// 32 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 33 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 34 | /// 35 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. 36 | /// A provider for progress updates. 37 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. 38 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 39 | { 40 | // Switch to main thread 41 | await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 42 | dte = await GetServiceAsync(typeof(EnvDTE.DTE)) as DTE2; 43 | vsSolution = await GetServiceAsync(typeof(IVsSolution)) as IVsSolution; 44 | 45 | // Register menu handlers 46 | OleMenuCommandService commandService = await GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; 47 | if (commandService == null) 48 | return; 49 | 50 | commandService.AddCommand(new MenuCommand(this.Execute, new CommandID(CommandSet, CommandId))); 51 | ScriptHost.ScriptServer_ConnectDebugger(this); 52 | } 53 | 54 | private void Execute(object sender, EventArgs e) 55 | { 56 | VsShellUtilities.ShowMessageBox(this, "test 1", "title 1", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 57 | } 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /Test/testScript/testScript.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5761F698-0F66-47B3-BFE7-883ACA64F513} 8 | WinExe 9 | testScript 10 | testScript 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | ..\..\bin\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | ..\..\bin\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {aff313bd-8d4e-4eb7-93ee-e43b751bfd31} 57 | scriptStarter 58 | 59 | 60 | {8e97b0d6-c716-4d7c-b497-9bd09cce528e} 61 | ClassLibrary1 62 | False 63 | 64 | 65 | {cdd46471-5368-480d-90b1-7679d051562e} 66 | ClassLibrary2 67 | False 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/syslog_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/sinks/base_sink.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace spdlog { 19 | namespace sinks { 20 | /** 21 | * Sink that write to syslog using the `syscall()` library call. 22 | * 23 | * Locking is not needed, as `syslog()` itself is thread-safe. 24 | */ 25 | template 26 | class syslog_sink : public base_sink 27 | { 28 | public: 29 | // 30 | explicit syslog_sink(std::string ident = "", int syslog_option = 0, int syslog_facility = LOG_USER) 31 | : ident_(std::move(ident)) 32 | { 33 | priorities_[static_cast(level::trace)] = LOG_DEBUG; 34 | priorities_[static_cast(level::debug)] = LOG_DEBUG; 35 | priorities_[static_cast(level::info)] = LOG_INFO; 36 | priorities_[static_cast(level::warn)] = LOG_WARNING; 37 | priorities_[static_cast(level::err)] = LOG_ERR; 38 | priorities_[static_cast(level::critical)] = LOG_CRIT; 39 | priorities_[static_cast(level::off)] = LOG_INFO; 40 | 41 | // set ident to be program name if empty 42 | ::openlog(ident_.empty() ? nullptr : ident_.c_str(), syslog_option, syslog_facility); 43 | } 44 | 45 | ~syslog_sink() override 46 | { 47 | ::closelog(); 48 | } 49 | 50 | syslog_sink(const syslog_sink &) = delete; 51 | syslog_sink &operator=(const syslog_sink &) = delete; 52 | 53 | protected: 54 | void sink_it_(const details::log_msg &msg) override 55 | { 56 | ::syslog(syslog_prio_from_level(msg), "%s", fmt::to_string(msg.payload).c_str()); 57 | } 58 | 59 | void flush_() override {} 60 | 61 | private: 62 | std::array priorities_; 63 | // must store the ident because the man says openlog might use the pointer as 64 | // is and not a string copy 65 | const std::string ident_; 66 | 67 | // 68 | // Simply maps spdlog's log level to syslog priority level. 69 | // 70 | int syslog_prio_from_level(const details::log_msg &msg) const 71 | { 72 | return priorities_[static_cast(msg.level)]; 73 | } 74 | }; 75 | 76 | using syslog_sink_mt = syslog_sink; 77 | using syslog_sink_st = syslog_sink; 78 | } // namespace sinks 79 | 80 | // Create and register a syslog logger 81 | template 82 | inline std::shared_ptr syslog_logger_mt( 83 | const std::string &logger_name, const std::string &syslog_ident = "", int syslog_option = 0, int syslog_facility = (1 << 3)) 84 | { 85 | return Factory::template create(logger_name, syslog_ident, syslog_option, syslog_facility); 86 | } 87 | 88 | template 89 | inline std::shared_ptr syslog_logger_st( 90 | const std::string &logger_name, const std::string &syslog_ident = "", int syslog_option = 0, int syslog_facility = (1 << 3)) 91 | { 92 | return Factory::template create(logger_name, syslog_ident, syslog_option, syslog_facility); 93 | } 94 | } // namespace spdlog 95 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/stdout_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/console_globals.h" 13 | #include "spdlog/details/null_mutex.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace spdlog { 20 | 21 | namespace sinks { 22 | 23 | template 24 | class stdout_sink final : public sink 25 | { 26 | public: 27 | using mutex_t = typename ConsoleMutex::mutex_t; 28 | stdout_sink() 29 | : mutex_(ConsoleMutex::mutex()) 30 | , file_(TargetStream::stream()) 31 | { 32 | } 33 | ~stdout_sink() override = default; 34 | 35 | stdout_sink(const stdout_sink &other) = delete; 36 | stdout_sink &operator=(const stdout_sink &other) = delete; 37 | 38 | void log(const details::log_msg &msg) override 39 | { 40 | std::lock_guard lock(mutex_); 41 | fmt::memory_buffer formatted; 42 | formatter_->format(msg, formatted); 43 | fwrite(formatted.data(), sizeof(char), formatted.size(), file_); 44 | fflush(TargetStream::stream()); 45 | } 46 | 47 | void flush() override 48 | { 49 | std::lock_guard lock(mutex_); 50 | fflush(file_); 51 | } 52 | 53 | void set_pattern(const std::string &pattern) override 54 | { 55 | std::lock_guard lock(mutex_); 56 | formatter_ = std::unique_ptr(new pattern_formatter(pattern)); 57 | } 58 | 59 | void set_formatter(std::unique_ptr sink_formatter) override 60 | { 61 | std::lock_guard lock(mutex_); 62 | formatter_ = std::move(sink_formatter); 63 | } 64 | 65 | private: 66 | mutex_t &mutex_; 67 | FILE *file_; 68 | }; 69 | 70 | using stdout_sink_mt = stdout_sink; 71 | using stdout_sink_st = stdout_sink; 72 | 73 | using stderr_sink_mt = stdout_sink; 74 | using stderr_sink_st = stdout_sink; 75 | 76 | } // namespace sinks 77 | 78 | // factory methods 79 | template 80 | inline std::shared_ptr stdout_logger_mt(const std::string &logger_name) 81 | { 82 | return Factory::template create(logger_name); 83 | } 84 | 85 | template 86 | inline std::shared_ptr stdout_logger_st(const std::string &logger_name) 87 | { 88 | return Factory::template create(logger_name); 89 | } 90 | 91 | template 92 | inline std::shared_ptr stderr_logger_mt(const std::string &logger_name) 93 | { 94 | return Factory::template create(logger_name); 95 | } 96 | 97 | template 98 | inline std::shared_ptr stderr_logger_st(const std::string &logger_name) 99 | { 100 | return Factory::template create(logger_name); 101 | } 102 | } // namespace spdlog 103 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/async.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Copyright(c) 2018 Gabi Melman. 4 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 5 | // 6 | 7 | #pragma once 8 | 9 | // 10 | // Async logging using global thread pool 11 | // All loggers created here share same global thread pool. 12 | // Each log message is pushed to a queue along withe a shared pointer to the 13 | // logger. 14 | // If a logger deleted while having pending messages in the queue, it's actual 15 | // destruction will defer 16 | // until all its messages are processed by the thread pool. 17 | // This is because each message in the queue holds a shared_ptr to the 18 | // originating logger. 19 | 20 | #include "spdlog/async_logger.h" 21 | #include "spdlog/details/registry.h" 22 | #include "spdlog/details/thread_pool.h" 23 | 24 | #include 25 | #include 26 | 27 | namespace spdlog { 28 | 29 | namespace details { 30 | static const size_t default_async_q_size = 8192; 31 | } 32 | 33 | // async logger factory - creates async loggers backed with thread pool. 34 | // if a global thread pool doesn't already exist, create it with default queue 35 | // size of 8192 items and single thread. 36 | template 37 | struct async_factory_impl 38 | { 39 | template 40 | static std::shared_ptr create(std::string logger_name, SinkArgs &&... args) 41 | { 42 | auto ®istry_inst = details::registry::instance(); 43 | 44 | // create global thread pool if not already exists.. 45 | std::lock_guard tp_lock(registry_inst.tp_mutex()); 46 | auto tp = registry_inst.get_tp(); 47 | if (tp == nullptr) 48 | { 49 | tp = std::make_shared(details::default_async_q_size, 1); 50 | registry_inst.set_tp(tp); 51 | } 52 | 53 | auto sink = std::make_shared(std::forward(args)...); 54 | auto new_logger = std::make_shared(std::move(logger_name), std::move(sink), std::move(tp), OverflowPolicy); 55 | registry_inst.initialize_logger(new_logger); 56 | return new_logger; 57 | } 58 | }; 59 | 60 | using async_factory = async_factory_impl; 61 | using async_factory_nonblock = async_factory_impl; 62 | 63 | template 64 | inline std::shared_ptr create_async(std::string logger_name, SinkArgs &&... sink_args) 65 | { 66 | return async_factory::create(std::move(logger_name), std::forward(sink_args)...); 67 | } 68 | 69 | template 70 | inline std::shared_ptr create_async_nb(std::string logger_name, SinkArgs &&... sink_args) 71 | { 72 | return async_factory_nonblock::create(std::move(logger_name), std::forward(sink_args)...); 73 | } 74 | 75 | // set global thread pool. 76 | inline void init_thread_pool(size_t q_size, size_t thread_count) 77 | { 78 | auto tp = std::make_shared(q_size, thread_count); 79 | details::registry::instance().set_tp(std::move(tp)); 80 | } 81 | 82 | // get the global thread pool. 83 | inline std::shared_ptr thread_pool() 84 | { 85 | return details::registry::instance().get_tp(); 86 | } 87 | } // namespace spdlog 88 | -------------------------------------------------------------------------------- /pugixml/pugixml.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {_root} 5 | none 6 | 7 | _root 8 | 9 | 10 | 11 | 12 | {(pugi::xml_node_type)(header & 0xf),en} name={name,na} value={value,na} 13 | {(pugi::xml_node_type)(header & 0xf),en} name={name,na} 14 | {(pugi::xml_node_type)(header & 0xf),en} value={value,na} 15 | {(pugi::xml_node_type)(header & 0xf),en} 16 | 17 | value,na 18 | 19 | 20 | 21 | 22 | 23 | 24 | curr,view(child)na 25 | curr = curr->next_attribute 26 | 27 | 28 | 29 | 30 | 31 | first_child 32 | next_sibling 33 | this,na 34 | 35 | 36 | 37 | 38 | 39 | {_attr} 40 | none 41 | 42 | _attr 43 | 44 | 45 | 46 | 47 | {name,na} = {value,na} 48 | {value,na} 49 | 50 | name,na 51 | value,na 52 | 53 | 54 | 55 | 56 | {_node,na} "{_attribute._attr->name,na}"="{_attribute._attr->value,na}" 57 | {_node,na} 58 | {_attribute} 59 | empty 60 | 61 | _node 62 | _attribute 63 | _node,na 64 | _attribute,na 65 | 66 | 67 | 68 | 69 | 70 | _type 71 | 72 | _end - _begin 73 | _begin 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Tools/vsStart/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Thread = System.Threading.Thread; 4 | 5 | /// 6 | /// Utility functions. 7 | /// 8 | public class Utils 9 | { 10 | /// 11 | /// Calls a function, retrying if necessary. 12 | /// 13 | /// DTE functions call into an instance of Visual Studio running in 14 | /// a separate process using COM interop. These calls can fail if 15 | /// Visual Studio is busy, and in these cases we get a COM exception. 16 | /// 17 | /// This function will retry calling the function if this happens, and 18 | /// will only fail if it has retried 20 times without success. 19 | /// 20 | /// You pass in the function - or property - to call usually as a 21 | /// lambda. For example, to get the projects.Count property you would 22 | /// call: 23 | /// 24 | /// int count = dteCall[int](() => (projects.Count)); 25 | /// 26 | /// (Note: replace the [] above with angle-brackets to specify the 27 | /// return type.) 28 | /// 29 | public static T call(Func fn) 30 | { 31 | int numTries = 20; 32 | int intervalMS = 100; 33 | 34 | // We will try to call the function a number of times... 35 | for (int i = 0; i < numTries; ++i) 36 | { 37 | try 38 | { 39 | // We call the function passed in and return the result... 40 | return fn(); 41 | } 42 | catch (COMException ex) 43 | { 44 | if ((uint)ex.ErrorCode == 0x8001010a) // RPC_E_SERVERCALL_RETRYLATER: The message filter indicated that the application is busy. 45 | { 46 | // Server is busy - we sleep for a short while, and then try again... 47 | Thread.Sleep(intervalMS); 48 | } 49 | else 50 | throw ex; 51 | } 52 | } 53 | 54 | throw new Exception(String.Format("'call' failed to call function after {0} tries.", numTries)); 55 | } 56 | 57 | /// 58 | /// Calls a function with no return value, retrying if necessary. 59 | /// 60 | public static void callVoidFunction(Action fn) 61 | { 62 | int numTries = 20; 63 | int intervalMS = 50; 64 | 65 | // We will try to call the function a number of times... 66 | for (int i = 0; i < numTries; ++i) 67 | { 68 | try 69 | { 70 | // We call the function passed in, and return 71 | // if it succeeds... 72 | fn(); 73 | return; 74 | } 75 | catch (COMException ex) 76 | { 77 | if ((uint)ex.ErrorCode == 0x8001010a) // RPC_E_SERVERCALL_RETRYLATER: The message filter indicated that the application is busy. 78 | { 79 | // Server is busy - we sleep for a short while, and then try again... 80 | Thread.Sleep(intervalMS); 81 | } 82 | else 83 | throw ex; 84 | } 85 | } 86 | 87 | throw new Exception(String.Format("'callVoidFunction' failed to call function after {0} tries.", numTries)); 88 | } 89 | 90 | } 91 | 92 | 93 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/async_logger_impl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // async logger implementation 9 | // uses a thread pool to perform the actual logging 10 | 11 | #include "spdlog/details/thread_pool.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | template 18 | inline spdlog::async_logger::async_logger( 19 | std::string logger_name, It begin, It end, std::weak_ptr tp, async_overflow_policy overflow_policy) 20 | : logger(std::move(logger_name), begin, end) 21 | , thread_pool_(std::move(tp)) 22 | , overflow_policy_(overflow_policy) 23 | { 24 | } 25 | 26 | inline spdlog::async_logger::async_logger( 27 | std::string logger_name, sinks_init_list sinks_list, std::weak_ptr tp, async_overflow_policy overflow_policy) 28 | : async_logger(std::move(logger_name), sinks_list.begin(), sinks_list.end(), std::move(tp), overflow_policy) 29 | { 30 | } 31 | 32 | inline spdlog::async_logger::async_logger( 33 | std::string logger_name, sink_ptr single_sink, std::weak_ptr tp, async_overflow_policy overflow_policy) 34 | : async_logger(std::move(logger_name), {std::move(single_sink)}, std::move(tp), overflow_policy) 35 | { 36 | } 37 | 38 | // send the log message to the thread pool 39 | inline void spdlog::async_logger::sink_it_(details::log_msg &msg) 40 | { 41 | #if defined(SPDLOG_ENABLE_MESSAGE_COUNTER) 42 | incr_msg_counter_(msg); 43 | #endif 44 | if (auto pool_ptr = thread_pool_.lock()) 45 | { 46 | pool_ptr->post_log(shared_from_this(), msg, overflow_policy_); 47 | } 48 | else 49 | { 50 | throw spdlog_ex("async log: thread pool doesn't exist anymore"); 51 | } 52 | } 53 | 54 | // send flush request to the thread pool 55 | inline void spdlog::async_logger::flush_() 56 | { 57 | if (auto pool_ptr = thread_pool_.lock()) 58 | { 59 | pool_ptr->post_flush(shared_from_this(), overflow_policy_); 60 | } 61 | else 62 | { 63 | throw spdlog_ex("async flush: thread pool doesn't exist anymore"); 64 | } 65 | } 66 | 67 | // 68 | // backend functions - called from the thread pool to do the actual job 69 | // 70 | inline void spdlog::async_logger::backend_log_(const details::log_msg &incoming_log_msg) 71 | { 72 | try 73 | { 74 | for (auto &s : sinks_) 75 | { 76 | if (s->should_log(incoming_log_msg.level)) 77 | { 78 | s->log(incoming_log_msg); 79 | } 80 | } 81 | } 82 | SPDLOG_CATCH_AND_HANDLE 83 | 84 | if (should_flush_(incoming_log_msg)) 85 | { 86 | backend_flush_(); 87 | } 88 | } 89 | 90 | inline void spdlog::async_logger::backend_flush_() 91 | { 92 | try 93 | { 94 | for (auto &sink : sinks_) 95 | { 96 | sink->flush(); 97 | } 98 | } 99 | SPDLOG_CATCH_AND_HANDLE 100 | } 101 | 102 | inline std::shared_ptr spdlog::async_logger::clone(std::string new_name) 103 | { 104 | auto cloned = std::make_shared(std::move(new_name), sinks_.begin(), sinks_.end(), thread_pool_, overflow_policy_); 105 | 106 | cloned->set_level(this->level()); 107 | cloned->flush_on(this->flush_level()); 108 | cloned->set_error_handler(this->error_handler()); 109 | return std::move(cloned); 110 | } 111 | -------------------------------------------------------------------------------- /VSSyncProj/ExecuteScript.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using System.Globalization; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Shell; 8 | using Microsoft.VisualStudio.Shell.Interop; 9 | using Task = System.Threading.Tasks.Task; 10 | 11 | namespace VSSyncProj 12 | { 13 | /// 14 | /// Command handler 15 | /// 16 | internal sealed class ExecuteScript 17 | { 18 | /// 19 | /// Command ID. 20 | /// 21 | public const int CommandId = 256; 22 | 23 | /// 24 | /// Command menu group (command set GUID). 25 | /// 26 | public static readonly Guid CommandSet = new Guid("23ea7c6c-88b1-46b7-8b45-66d2294edad4"); 27 | 28 | /// 29 | /// VS Package that provides this command, not null. 30 | /// 31 | private readonly AsyncPackage package; 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// Adds our command handlers for menu (commands must exist in the command table file) 36 | /// 37 | /// Owner package, not null. 38 | /// Command service to add command to, not null. 39 | private ExecuteScript(AsyncPackage package, OleMenuCommandService commandService) 40 | { 41 | this.package = package ?? throw new ArgumentNullException(nameof(package)); 42 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); 43 | 44 | var menuCommandID = new CommandID(CommandSet, CommandId); 45 | var menuItem = new MenuCommand(this.Execute, menuCommandID); 46 | commandService.AddCommand(menuItem); 47 | } 48 | 49 | /// 50 | /// Gets the instance of the command. 51 | /// 52 | public static ExecuteScript Instance 53 | { 54 | get; 55 | private set; 56 | } 57 | 58 | /// 59 | /// Gets the service provider from the owner package. 60 | /// 61 | private Microsoft.VisualStudio.Shell.IAsyncServiceProvider ServiceProvider 62 | { 63 | get 64 | { 65 | return this.package; 66 | } 67 | } 68 | 69 | /// 70 | /// Initializes the singleton instance of the command. 71 | /// 72 | /// Owner package, not null. 73 | public static async Task InitializeAsync(AsyncPackage package) 74 | { 75 | // Switch to the main thread - the call to AddCommand in ExecuteScript's constructor requires 76 | // the UI thread. 77 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); 78 | 79 | OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; 80 | Instance = new ExecuteScript(package, commandService); 81 | } 82 | 83 | /// 84 | /// Menu item clicked. 85 | /// 86 | private void Execute(object sender, EventArgs e) 87 | { 88 | ThreadHelper.ThrowIfNotOnUIThread(); 89 | 90 | 91 | 92 | 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Tools/VSModel/VSModel.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2807D6B3-0F45-491C-8D18-883EEB0CF412} 8 | Exe 9 | VSModel 10 | VSModel 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | $(ProjectDir)..\..\bin\ 22 | $(ProjectDir)..\..\obj\$(MSBuildProjectName)_$(Configuration)_$(Platform) 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | $(ProjectDir)..\..\bin\ 32 | $(ProjectDir)..\..\obj\$(MSBuildProjectName)_$(Configuration)_$(Platform) 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | vsmodel\Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.cs 50 | 51 | 52 | vsmodel\Microsoft.VisualStudio.VCProject.cs 53 | 54 | 55 | vsmodel\Microsoft.VisualStudio.VCProjectEngine.cs 56 | 57 | 58 | vsmodel\Microsoft.VisualStudio.VCProjectEngine_enums.cs 59 | 60 | 61 | vsmodel\Microsoft.VisualStudio.VCProject_enums.cs 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /scriptStarter/scriptStarter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AFF313BD-8D4E-4EB7-93EE-E43B751BFD31} 8 | Exe 9 | scriptStarter 10 | scriptStarter 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | ..\bin\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | ..\bin\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | False 38 | False 39 | ..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte.dll 40 | 41 | 42 | False 43 | True 44 | ..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte80.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | MessageFilter.cs 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | {8e97b0d6-c716-4d7c-b497-9bd09cce528e} 73 | ClassLibrary1 74 | False 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /SolutionProjectModel/ProjectFile.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "ProjectFile.h" 3 | #include "Project.h" 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace pugi; 9 | using namespace std::filesystem; 10 | 11 | string lowercased( string s ) 12 | { 13 | std::transform(s.begin(), s.end(), s.begin(), ::tolower); 14 | return s; 15 | } 16 | 17 | ProjectFile::ProjectFile() 18 | { 19 | ReflectConnectChildren(nullptr); 20 | } 21 | 22 | void ProjectFile::VisitTool( 23 | std::function visitConf, 24 | CppTypeInfo* confType, 25 | const wchar_t* _configurationName, const wchar_t* _platform) 26 | { 27 | if(!project) 28 | return; 29 | 30 | function visitTool = [&]( const wchar_t* configurationName, const wchar_t* platform ) 31 | { 32 | auto it = find_if(tools.begin(), tools.end(), [&](auto& t) { return t->platform == platform && t->configurationName == configurationName; }); 33 | if (it != tools.end()) 34 | { 35 | if(visitConf) 36 | visitConf((*it).get()); 37 | 38 | return; 39 | } 40 | 41 | if(!confType) 42 | return; 43 | 44 | shared_ptr props; 45 | confType->ReflectCreateInstance(props); 46 | props->platform = platform; 47 | props->configurationName = configurationName; 48 | props->projectFile = this; 49 | tools.push_back(props); 50 | 51 | if (visitConf) 52 | visitConf(props.get()); 53 | }; 54 | 55 | if (_configurationName == nullptr || _platform == nullptr) 56 | { 57 | project->VisitConfigurations 58 | ( 59 | [&](VCConfiguration& c) 60 | { 61 | visitTool(c.configurationName.c_str(), c.platform.c_str()); 62 | }, 63 | _configurationName, _platform 64 | ); 65 | } 66 | else 67 | { 68 | visitTool(_configurationName, _platform); 69 | } 70 | } 71 | 72 | 73 | // 74 | // Generic autoprobe - file extension to guessed type. 75 | // 76 | EItemType ProjectFile::GetFromPath(const wchar_t* file) 77 | { 78 | string ext = lowercased(path(file).extension().string().substr(1)); 79 | 80 | struct TypeInfoStr 81 | { 82 | const char* ext; 83 | EItemType type; 84 | } types [] = 85 | { 86 | {"properties", AntProjectPropertiesFile}, 87 | {"h", ClInclude}, 88 | {"c", ClCompile}, 89 | {"cxx", ClCompile}, 90 | {"cpp", ClCompile}, 91 | {"cc", ClCompile}, 92 | {"java", JavaCompile}, 93 | {"template", GradleTemplate}, 94 | {"rc", ResourceCompile}, 95 | {"ico", Image}, 96 | {"txt", Text}, 97 | {"natvis", Natvis}, 98 | {"?", None} 99 | }; 100 | 101 | TypeInfoStr* end = types + _countof(types) - 1; 102 | return find_if(types, end, [ext](TypeInfoStr& ti) { return ti.ext == ext; } )->type; 103 | } 104 | 105 | void ProjectFile::OnAfterSetProperty(ReflectPath& path) 106 | { 107 | if(path.steps.size() == 1) 108 | { 109 | auto step = path.steps.front(); 110 | 111 | if(strcmp(step.propertyName, "ItemType") == 0) 112 | { 113 | FieldInfo* fi = step.typeInfo->GetField(step.propertyName); 114 | CStringW newName = fi->fieldType->ToString((char*)step.instance->ReflectGetInstance() + fi->offset); 115 | 116 | if(newName != node.name()) 117 | { 118 | for(auto childnode: node.children()) 119 | node.remove_child(childnode); 120 | 121 | node.set_name(newName); 122 | } 123 | } 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/sinks/android_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifndef SPDLOG_H 9 | #include "spdlog/spdlog.h" 10 | #endif 11 | 12 | #include "spdlog/details/fmt_helper.h" 13 | #include "spdlog/details/null_mutex.h" 14 | #include "spdlog/details/os.h" 15 | #include "spdlog/sinks/base_sink.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #if !defined(SPDLOG_ANDROID_RETRIES) 24 | #define SPDLOG_ANDROID_RETRIES 2 25 | #endif 26 | 27 | namespace spdlog { 28 | namespace sinks { 29 | 30 | /* 31 | * Android sink (logging using __android_log_write) 32 | */ 33 | template 34 | class android_sink final : public base_sink 35 | { 36 | public: 37 | explicit android_sink(std::string tag = "spdlog", bool use_raw_msg = false) 38 | : tag_(std::move(tag)) 39 | , use_raw_msg_(use_raw_msg) 40 | { 41 | } 42 | 43 | protected: 44 | void sink_it_(const details::log_msg &msg) override 45 | { 46 | const android_LogPriority priority = convert_to_android_(msg.level); 47 | fmt::memory_buffer formatted; 48 | if (use_raw_msg_) 49 | { 50 | details::fmt_helper::append_string_view(msg.payload, formatted); 51 | } 52 | else 53 | { 54 | sink::formatter_->format(msg, formatted); 55 | } 56 | formatted.push_back('\0'); 57 | const char *msg_output = formatted.data(); 58 | 59 | // See system/core/liblog/logger_write.c for explanation of return value 60 | int ret = __android_log_write(priority, tag_.c_str(), msg_output); 61 | int retry_count = 0; 62 | while ((ret == -11 /*EAGAIN*/) && (retry_count < SPDLOG_ANDROID_RETRIES)) 63 | { 64 | details::os::sleep_for_millis(5); 65 | ret = __android_log_write(priority, tag_.c_str(), msg_output); 66 | retry_count++; 67 | } 68 | 69 | if (ret < 0) 70 | { 71 | throw spdlog_ex("__android_log_write() failed", ret); 72 | } 73 | } 74 | 75 | void flush_() override {} 76 | 77 | private: 78 | static android_LogPriority convert_to_android_(spdlog::level::level_enum level) 79 | { 80 | switch (level) 81 | { 82 | case spdlog::level::trace: 83 | return ANDROID_LOG_VERBOSE; 84 | case spdlog::level::debug: 85 | return ANDROID_LOG_DEBUG; 86 | case spdlog::level::info: 87 | return ANDROID_LOG_INFO; 88 | case spdlog::level::warn: 89 | return ANDROID_LOG_WARN; 90 | case spdlog::level::err: 91 | return ANDROID_LOG_ERROR; 92 | case spdlog::level::critical: 93 | return ANDROID_LOG_FATAL; 94 | default: 95 | return ANDROID_LOG_DEFAULT; 96 | } 97 | } 98 | 99 | std::string tag_; 100 | bool use_raw_msg_; 101 | }; 102 | 103 | using android_sink_mt = android_sink; 104 | using android_sink_st = android_sink; 105 | } // namespace sinks 106 | 107 | // Create and register android syslog logger 108 | 109 | template 110 | inline std::shared_ptr android_logger_mt(const std::string &logger_name, const std::string &tag = "spdlog") 111 | { 112 | return Factory::template create(logger_name, tag); 113 | } 114 | 115 | template 116 | inline std::shared_ptr android_logger_st(const std::string &logger_name, const std::string &tag = "spdlog") 117 | { 118 | return Factory::template create(logger_name, tag); 119 | } 120 | 121 | } // namespace spdlog 122 | -------------------------------------------------------------------------------- /SolutionProjectModel/cppexec/expdef.cpp: -------------------------------------------------------------------------------- 1 | #include //DWORD 2 | #include //PIMAGE_DOS_HEADER 3 | #include 4 | 5 | // Originated from: 6 | // http://purefractalsolutions.com/show.php?a=utils/expdef 7 | 8 | using namespace std; 9 | 10 | #define PEEF_PRINT_ORDINALS 0x01 11 | #define PEEF_ORDER_BY_ORDINALS 0x02 12 | #define PEEF_MAKE_UNDERSCORE_ALIAS 0x04 13 | #define PEEF_MAKE_NO_UNDERSCORE_ALIAS 0x08 14 | #define PEEF_USE_FILENAME 0x10 15 | #define PEEF_CALL_LIB 0x20 16 | #define PEEF_VERBOSE 0x40 17 | 18 | static void printPeExports(FILE *pf, DWORD *base, DWORD flags) 19 | { 20 | PIMAGE_DOS_HEADER pDOSHeader = (PIMAGE_DOS_HEADER)base; 21 | PIMAGE_NT_HEADERS pNTHeaders = (PIMAGE_NT_HEADERS)((const char*)base + pDOSHeader->e_lfanew); 22 | PIMAGE_EXPORT_DIRECTORY pExportDir = (PIMAGE_EXPORT_DIRECTORY)((const char*)base + pNTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); 23 | PDWORD pAddr = (DWORD *)((const char*)base + pExportDir->AddressOfFunctions); 24 | PWORD pOrdinals = (WORD *)((const char*)base + pExportDir->AddressOfNameOrdinals); 25 | PDWORD pName = (DWORD *)((const char*)base + pExportDir->AddressOfNames); 26 | 27 | ::std::map< WORD, ::std::string > byOrdinal; 28 | 29 | const char* pModuleName = (const char*)((const char*)base + pExportDir->Name); 30 | 31 | //fprintf(pf, "LIBRARY %s\n", (flags&PEEF_USE_FILENAME) ? filename : (const char *)(pModuleName)); 32 | fprintf(pf, "EXPORTS\n"); 33 | 34 | for (DWORD i = 0; i < pExportDir->NumberOfNames; i++) 35 | { 36 | if (flags&PEEF_ORDER_BY_ORDINALS) 37 | { 38 | byOrdinal[(WORD)(pExportDir->Base) + pOrdinals[i]] = (const char*)base + pName[i]; 39 | } 40 | else 41 | { 42 | const char* fnName = (const char*)((const char*)base + pName[i]); 43 | fprintf(pf, " %s", fnName); 44 | if (flags&PEEF_PRINT_ORDINALS) 45 | fprintf(pf, " @%d", pExportDir->Base + pOrdinals[i]); 46 | fprintf(pf, "\n"); 47 | 48 | if (flags&PEEF_MAKE_NO_UNDERSCORE_ALIAS && *fnName == '_') 49 | { 50 | const char* newName = fnName; 51 | for (; *newName && *newName == '_'; ++newName) {} 52 | fprintf(pf, " %s=%s\n", newName, fnName); 53 | } 54 | 55 | if (flags&PEEF_MAKE_UNDERSCORE_ALIAS) 56 | fprintf(pf, " _%s=%s\n", fnName, fnName); 57 | 58 | fflush(pf); 59 | } 60 | } 61 | if (flags&PEEF_ORDER_BY_ORDINALS) 62 | { 63 | ::std::map< WORD, ::std::string >::const_iterator it = byOrdinal.begin(); 64 | for (; it != byOrdinal.end(); ++it) 65 | { 66 | fprintf(pf, " %s", (const char*)(it->second.c_str())); 67 | if (flags&PEEF_PRINT_ORDINALS) 68 | fprintf(pf, " @%d", it->first); 69 | fprintf(pf, "\n"); 70 | if (flags&PEEF_MAKE_NO_UNDERSCORE_ALIAS && *it->second.c_str() == '_') 71 | { 72 | const char* newName = it->second.c_str(); 73 | for (; *newName && *newName == '_'; ++newName) {} 74 | fprintf(pf, " %s=%s\n", newName, it->second.c_str()); 75 | } 76 | if (flags&PEEF_MAKE_UNDERSCORE_ALIAS) 77 | fprintf(pf, " _%s=%s\n", it->second.c_str(), it->second.c_str()); 78 | fflush(pf); 79 | } 80 | } 81 | } 82 | 83 | int printPeExports(const wchar_t* dll) 84 | { 85 | auto h = LoadLibraryExW(dll, 0, LOAD_LIBRARY_AS_DATAFILE); 86 | if(!h) 87 | { 88 | printf("Error: Failed to load dll '%S'", dll); 89 | return -3; 90 | } 91 | 92 | printPeExports(stdout, (DWORD*)h,0); 93 | FreeLibrary(h); 94 | 95 | return 0; 96 | } 97 | 98 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/mpmc_blocking_q.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Copyright(c) 2018 Gabi Melman. 5 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 6 | // 7 | 8 | // multi producer-multi consumer blocking queue. 9 | // enqueue(..) - will block until room found to put the new message. 10 | // enqueue_nowait(..) - will return immediately with false if no room left in 11 | // the queue. 12 | // dequeue_for(..) - will block until the queue is not empty or timeout have 13 | // passed. 14 | 15 | #include "spdlog/details/circular_q.h" 16 | 17 | #include 18 | #include 19 | 20 | namespace spdlog { 21 | namespace details { 22 | 23 | template 24 | class mpmc_blocking_queue 25 | { 26 | public: 27 | using item_type = T; 28 | explicit mpmc_blocking_queue(size_t max_items) 29 | : q_(max_items) 30 | { 31 | } 32 | 33 | #ifndef __MINGW32__ 34 | // try to enqueue and block if no room left 35 | void enqueue(T &&item) 36 | { 37 | { 38 | std::unique_lock lock(queue_mutex_); 39 | pop_cv_.wait(lock, [this] { return !this->q_.full(); }); 40 | q_.push_back(std::move(item)); 41 | } 42 | push_cv_.notify_one(); 43 | } 44 | 45 | // enqueue immediately. overrun oldest message in the queue if no room left. 46 | void enqueue_nowait(T &&item) 47 | { 48 | { 49 | std::unique_lock lock(queue_mutex_); 50 | q_.push_back(std::move(item)); 51 | } 52 | push_cv_.notify_one(); 53 | } 54 | 55 | // try to dequeue item. if no item found. wait upto timeout and try again 56 | // Return true, if succeeded dequeue item, false otherwise 57 | bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration) 58 | { 59 | { 60 | std::unique_lock lock(queue_mutex_); 61 | if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); })) 62 | { 63 | return false; 64 | } 65 | q_.pop_front(popped_item); 66 | } 67 | pop_cv_.notify_one(); 68 | return true; 69 | } 70 | 71 | #else 72 | // apparently mingw deadlocks if the mutex is released before cv.notify_one(), 73 | // so release the mutex at the very end each function. 74 | 75 | // try to enqueue and block if no room left 76 | void enqueue(T &&item) 77 | { 78 | std::unique_lock lock(queue_mutex_); 79 | pop_cv_.wait(lock, [this] { return !this->q_.full(); }); 80 | q_.push_back(std::move(item)); 81 | push_cv_.notify_one(); 82 | } 83 | 84 | // enqueue immediately. overrun oldest message in the queue if no room left. 85 | void enqueue_nowait(T &&item) 86 | { 87 | std::unique_lock lock(queue_mutex_); 88 | q_.push_back(std::move(item)); 89 | push_cv_.notify_one(); 90 | } 91 | 92 | // try to dequeue item. if no item found. wait upto timeout and try again 93 | // Return true, if succeeded dequeue item, false otherwise 94 | bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration) 95 | { 96 | std::unique_lock lock(queue_mutex_); 97 | if (!push_cv_.wait_for(lock, wait_duration, [this] { return !this->q_.empty(); })) 98 | { 99 | return false; 100 | } 101 | q_.pop_front(popped_item); 102 | pop_cv_.notify_one(); 103 | return true; 104 | } 105 | 106 | #endif 107 | 108 | size_t overrun_counter() 109 | { 110 | std::unique_lock lock(queue_mutex_); 111 | return q_.overrun_counter(); 112 | } 113 | 114 | private: 115 | std::mutex queue_mutex_; 116 | std::condition_variable push_cv_; 117 | std::condition_variable pop_cv_; 118 | spdlog::details::circular_q q_; 119 | }; 120 | } // namespace details 121 | } // namespace spdlog 122 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/fmt_helper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by gabi on 6/15/18. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include "spdlog/fmt/fmt.h" 10 | 11 | // Some fmt helpers to efficiently format and pad ints and strings 12 | namespace spdlog { 13 | namespace details { 14 | namespace fmt_helper { 15 | 16 | template 17 | inline spdlog::string_view_t to_string_view(const fmt::basic_memory_buffer &buf) SPDLOG_NOEXCEPT 18 | { 19 | return spdlog::string_view_t(buf.data(), buf.size()); 20 | } 21 | 22 | template 23 | inline void append_buf(const fmt::basic_memory_buffer &buf, fmt::basic_memory_buffer &dest) 24 | { 25 | auto *buf_ptr = buf.data(); 26 | dest.append(buf_ptr, buf_ptr + buf.size()); 27 | } 28 | 29 | template 30 | inline void append_string_view(spdlog::string_view_t view, fmt::basic_memory_buffer &dest) 31 | { 32 | auto *buf_ptr = view.data(); 33 | if (buf_ptr != nullptr) 34 | { 35 | dest.append(buf_ptr, buf_ptr + view.size()); 36 | } 37 | } 38 | 39 | template 40 | inline void append_int(T n, fmt::basic_memory_buffer &dest) 41 | { 42 | fmt::format_int i(n); 43 | dest.append(i.data(), i.data() + i.size()); 44 | } 45 | 46 | template 47 | inline unsigned count_digits(T n) 48 | { 49 | using count_type = typename std::conditional<(sizeof(T) > sizeof(uint32_t)), uint64_t, uint32_t>::type; 50 | return static_cast(fmt::internal::count_digits(static_cast(n))); 51 | } 52 | 53 | template 54 | inline void pad2(int n, fmt::basic_memory_buffer &dest) 55 | { 56 | if (n > 99) 57 | { 58 | append_int(n, dest); 59 | } 60 | else if (n > 9) // 10-99 61 | { 62 | dest.push_back(static_cast('0' + n / 10)); 63 | dest.push_back(static_cast('0' + n % 10)); 64 | } 65 | else if (n >= 0) // 0-9 66 | { 67 | dest.push_back('0'); 68 | dest.push_back(static_cast('0' + n)); 69 | } 70 | else // negatives (unlikely, but just in case, let fmt deal with it) 71 | { 72 | fmt::format_to(dest, "{:02}", n); 73 | } 74 | } 75 | 76 | template 77 | inline void pad_uint(T n, unsigned int width, fmt::basic_memory_buffer &dest) 78 | { 79 | static_assert(std::is_unsigned::value, "pad_uint must get unsigned T"); 80 | auto digits = count_digits(n); 81 | if (width > digits) 82 | { 83 | const char *zeroes = "0000000000000000000"; 84 | dest.append(zeroes, zeroes + width - digits); 85 | } 86 | append_int(n, dest); 87 | } 88 | 89 | template 90 | inline void pad3(T n, fmt::basic_memory_buffer &dest) 91 | { 92 | pad_uint(n, 3, dest); 93 | } 94 | 95 | template 96 | inline void pad6(T n, fmt::basic_memory_buffer &dest) 97 | { 98 | pad_uint(n, 6, dest); 99 | } 100 | 101 | template 102 | inline void pad9(T n, fmt::basic_memory_buffer &dest) 103 | { 104 | pad_uint(n, 9, dest); 105 | } 106 | 107 | // return fraction of a second of the given time_point. 108 | // e.g. 109 | // fraction(tp) -> will return the millis part of the second 110 | template 111 | inline ToDuration time_fraction(const log_clock::time_point &tp) 112 | { 113 | using std::chrono::duration_cast; 114 | using std::chrono::seconds; 115 | auto duration = tp.time_since_epoch(); 116 | auto secs = duration_cast(duration); 117 | return duration_cast(duration) - duration_cast(secs); 118 | } 119 | 120 | } // namespace fmt_helper 121 | } // namespace details 122 | } // namespace spdlog 123 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/src/gtest-matchers.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // The Google C++ Testing and Mocking Framework (Google Test) 31 | // 32 | // This file implements just enough of the matcher interface to allow 33 | // EXPECT_DEATH and friends to accept a matcher argument. 34 | 35 | #include "gtest/internal/gtest-internal.h" 36 | #include "gtest/internal/gtest-port.h" 37 | #include "gtest/gtest-matchers.h" 38 | 39 | #include 40 | 41 | namespace testing { 42 | 43 | // Constructs a matcher that matches a const std::string& whose value is 44 | // equal to s. 45 | Matcher::Matcher(const std::string& s) { *this = Eq(s); } 46 | 47 | // Constructs a matcher that matches a const std::string& whose value is 48 | // equal to s. 49 | Matcher::Matcher(const char* s) { 50 | *this = Eq(std::string(s)); 51 | } 52 | 53 | // Constructs a matcher that matches a std::string whose value is equal to 54 | // s. 55 | Matcher::Matcher(const std::string& s) { *this = Eq(s); } 56 | 57 | // Constructs a matcher that matches a std::string whose value is equal to 58 | // s. 59 | Matcher::Matcher(const char* s) { *this = Eq(std::string(s)); } 60 | 61 | #if GTEST_HAS_ABSL 62 | // Constructs a matcher that matches a const absl::string_view& whose value is 63 | // equal to s. 64 | Matcher::Matcher(const std::string& s) { 65 | *this = Eq(s); 66 | } 67 | 68 | // Constructs a matcher that matches a const absl::string_view& whose value is 69 | // equal to s. 70 | Matcher::Matcher(const char* s) { 71 | *this = Eq(std::string(s)); 72 | } 73 | 74 | // Constructs a matcher that matches a const absl::string_view& whose value is 75 | // equal to s. 76 | Matcher::Matcher(absl::string_view s) { 77 | *this = Eq(std::string(s)); 78 | } 79 | 80 | // Constructs a matcher that matches a absl::string_view whose value is equal to 81 | // s. 82 | Matcher::Matcher(const std::string& s) { *this = Eq(s); } 83 | 84 | // Constructs a matcher that matches a absl::string_view whose value is equal to 85 | // s. 86 | Matcher::Matcher(const char* s) { 87 | *this = Eq(std::string(s)); 88 | } 89 | 90 | // Constructs a matcher that matches a absl::string_view whose value is equal to 91 | // s. 92 | Matcher::Matcher(absl::string_view s) { 93 | *this = Eq(std::string(s)); 94 | } 95 | #endif // GTEST_HAS_ABSL 96 | 97 | } // namespace testing 98 | -------------------------------------------------------------------------------- /SolutionProjectModel/EnumReflect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | template 7 | class EnumReflect 8 | { 9 | public: 10 | static const char* getPrefix() { return ""; } 11 | static const char* getEnums() { return ""; } 12 | }; 13 | 14 | // 15 | // Just a container for each enumeration type. 16 | // 17 | template 18 | class EnumReflectBase 19 | { 20 | public: 21 | static std::map enum2int; 22 | static std::map int2enum; 23 | 24 | static void EnsureEnumMapReady( const char* enumsInfo, const char* prefix ) 25 | { 26 | if (*enumsInfo == 0 || enum2int.size() != 0 ) 27 | return; 28 | 29 | // Should be called once per each enumeration. 30 | std::string senumsInfo(enumsInfo); 31 | std::regex re("^([a-zA-Z_][a-zA-Z0-9_]+) *=? *([^,]*)(,|$) *"); // C++ identifier to optional " = " 32 | std::smatch sm; 33 | int value = 0; 34 | auto prefixLen = strlen(prefix); 35 | 36 | for (; regex_search(senumsInfo, sm, re); senumsInfo = sm.suffix(), value++) 37 | { 38 | std::string enumName = sm[1].str(); 39 | std::string enumValue = sm[2].str(); 40 | 41 | if (prefixLen != 0 && enumName.length() >= prefixLen) 42 | enumName = enumName.substr(prefixLen); 43 | 44 | if (enumValue.length() != 0) 45 | value = atoi(enumValue.c_str()); 46 | 47 | enum2int[enumName] = value; 48 | int2enum[value] = enumName; 49 | } 50 | } 51 | }; 52 | 53 | template 54 | std::map EnumReflectBase::enum2int; 55 | 56 | template 57 | std::map EnumReflectBase::int2enum; 58 | 59 | 60 | #define DECLARE_ENUM(name, prefix, ...) \ 61 | enum name { __VA_ARGS__ }; \ 62 | template <> \ 63 | class EnumReflect<##name>: public EnumReflectBase<##name> { \ 64 | public: \ 65 | static const char* getPrefix() { return prefix; } \ 66 | static const char* getEnums() { return #__VA_ARGS__; } \ 67 | }; 68 | 69 | 70 | 71 | 72 | /* 73 | Basic usage: 74 | 75 | Declare enumeration: 76 | 77 | DECLARE_ENUM( enumName, 78 | // Prefix for all enums, "" if no prefix used. 79 | "myenum_", 80 | 81 | myenum_enumValue1, 82 | myenum_enumValue2, 83 | myenum_enumValue3 = 5, 84 | 85 | // comment 86 | myenum_enumValue4 87 | ); 88 | 89 | Conversion logic: 90 | 91 | From enumeration to string: 92 | 93 | printf( EnumToString(myenum_enumValue3).c_str() ); 94 | 95 | => "enumValue3" 96 | 97 | From string to enumeration: 98 | 99 | enumName value; 100 | 101 | if( !StringToEnum("enumValue4", value) ) 102 | printf("Conversion failed..."); 103 | 104 | => 105 | 106 | value == myenum_enumValue4 107 | */ 108 | 109 | // 110 | // Converts enumeration to string, if not found - empty string is returned. 111 | // 112 | template 113 | std::string EnumToString(T t) 114 | { 115 | EnumReflect::EnsureEnumMapReady(EnumReflect::getEnums(), EnumReflect::getPrefix()); 116 | auto& int2enum = EnumReflect::int2enum; 117 | auto it = int2enum.find(t); 118 | 119 | if (it == int2enum.end()) 120 | return ""; 121 | 122 | return it->second; 123 | } 124 | 125 | // 126 | // Converts string to enumeration, if not found - false is returned. 127 | // 128 | template 129 | bool StringToEnum(const char* enumName, T& t) 130 | { 131 | EnumReflect::EnsureEnumMapReady(EnumReflect::getEnums(), EnumReflect::getPrefix()); 132 | auto& enum2int = EnumReflect::enum2int; 133 | auto it = enum2int.find(enumName); 134 | 135 | if (it == enum2int.end()) 136 | return false; 137 | 138 | t = (T) it->second; 139 | return true; 140 | } 141 | 142 | 143 | -------------------------------------------------------------------------------- /SolutionProjectModel/testCppApp.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {74657374-4370-7041-7070-000000000000} 15 | true 16 | Win32Proj 17 | testCppApp 18 | 10.0.17763.0 19 | 20 | 21 | 22 | Application 23 | true 24 | v141 25 | Unicode 26 | 27 | 28 | Application 29 | true 30 | v141 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | true 45 | $(ProjectDir)\..\ 46 | $(ProjectDir)\obj\$(Platform)_$(Configuration)\ 47 | 48 | 49 | true 50 | $(ProjectDir)\..\ 51 | $(ProjectDir)\obj\$(Platform)_$(Configuration)\ 52 | 53 | 54 | 55 | Disabled 56 | ProgramDatabase 57 | stdcpp17 58 | 59 | 60 | Console 61 | true 62 | 63 | 64 | 65 | 66 | Disabled 67 | ProgramDatabase 68 | stdcpp17 69 | 70 | 71 | Console 72 | true 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | {D44945D6-4DED-4434-91D7-2B812537DF6E} 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/gtest/internal/gtest-port-arch.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // The Google C++ Testing and Mocking Framework (Google Test) 31 | // 32 | // This header file defines the GTEST_OS_* macro. 33 | // It is separate from gtest-port.h so that custom/gtest-port.h can include it. 34 | 35 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 36 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 37 | 38 | // Determines the platform on which Google Test is compiled. 39 | #ifdef __CYGWIN__ 40 | # define GTEST_OS_CYGWIN 1 41 | # elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) 42 | # define GTEST_OS_WINDOWS_MINGW 1 43 | # define GTEST_OS_WINDOWS 1 44 | #elif defined _WIN32 45 | # define GTEST_OS_WINDOWS 1 46 | # ifdef _WIN32_WCE 47 | # define GTEST_OS_WINDOWS_MOBILE 1 48 | # elif defined(WINAPI_FAMILY) 49 | # include 50 | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 51 | # define GTEST_OS_WINDOWS_DESKTOP 1 52 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) 53 | # define GTEST_OS_WINDOWS_PHONE 1 54 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 55 | # define GTEST_OS_WINDOWS_RT 1 56 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) 57 | # define GTEST_OS_WINDOWS_PHONE 1 58 | # define GTEST_OS_WINDOWS_TV_TITLE 1 59 | # else 60 | // WINAPI_FAMILY defined but no known partition matched. 61 | // Default to desktop. 62 | # define GTEST_OS_WINDOWS_DESKTOP 1 63 | # endif 64 | # else 65 | # define GTEST_OS_WINDOWS_DESKTOP 1 66 | # endif // _WIN32_WCE 67 | #elif defined __OS2__ 68 | # define GTEST_OS_OS2 1 69 | #elif defined __APPLE__ 70 | # define GTEST_OS_MAC 1 71 | # if TARGET_OS_IPHONE 72 | # define GTEST_OS_IOS 1 73 | # endif 74 | #elif defined __DragonFly__ 75 | # define GTEST_OS_DRAGONFLY 1 76 | #elif defined __FreeBSD__ 77 | # define GTEST_OS_FREEBSD 1 78 | #elif defined __Fuchsia__ 79 | # define GTEST_OS_FUCHSIA 1 80 | #elif defined(__GLIBC__) && defined(__FreeBSD_kernel__) 81 | # define GTEST_OS_GNU_KFREEBSD 1 82 | #elif defined __linux__ 83 | # define GTEST_OS_LINUX 1 84 | # if defined __ANDROID__ 85 | # define GTEST_OS_LINUX_ANDROID 1 86 | # endif 87 | #elif defined __MVS__ 88 | # define GTEST_OS_ZOS 1 89 | #elif defined(__sun) && defined(__SVR4) 90 | # define GTEST_OS_SOLARIS 1 91 | #elif defined(_AIX) 92 | # define GTEST_OS_AIX 1 93 | #elif defined(__hpux) 94 | # define GTEST_OS_HPUX 1 95 | #elif defined __native_client__ 96 | # define GTEST_OS_NACL 1 97 | #elif defined __NetBSD__ 98 | # define GTEST_OS_NETBSD 1 99 | #elif defined __OpenBSD__ 100 | # define GTEST_OS_OPENBSD 1 101 | #elif defined __QNX__ 102 | # define GTEST_OS_QNX 1 103 | #elif defined(__HAIKU__) 104 | #define GTEST_OS_HAIKU 1 105 | #endif // __CYGWIN__ 106 | 107 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ 108 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/src/gtest-typed-test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "gtest/gtest-typed-test.h" 32 | 33 | #include "gtest/gtest.h" 34 | 35 | namespace testing { 36 | namespace internal { 37 | 38 | #if GTEST_HAS_TYPED_TEST_P 39 | 40 | // Skips to the first non-space char in str. Returns an empty string if str 41 | // contains only whitespace characters. 42 | static const char* SkipSpaces(const char* str) { 43 | while (IsSpace(*str)) 44 | str++; 45 | return str; 46 | } 47 | 48 | static std::vector SplitIntoTestNames(const char* src) { 49 | std::vector name_vec; 50 | src = SkipSpaces(src); 51 | for (; src != nullptr; src = SkipComma(src)) { 52 | name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src))); 53 | } 54 | return name_vec; 55 | } 56 | 57 | // Verifies that registered_tests match the test names in 58 | // registered_tests_; returns registered_tests if successful, or 59 | // aborts the program otherwise. 60 | const char* TypedTestSuitePState::VerifyRegisteredTestNames( 61 | const char* file, int line, const char* registered_tests) { 62 | typedef RegisteredTestsMap::const_iterator RegisteredTestIter; 63 | registered_ = true; 64 | 65 | std::vector name_vec = SplitIntoTestNames(registered_tests); 66 | 67 | Message errors; 68 | 69 | std::set tests; 70 | for (std::vector::const_iterator name_it = name_vec.begin(); 71 | name_it != name_vec.end(); ++name_it) { 72 | const std::string& name = *name_it; 73 | if (tests.count(name) != 0) { 74 | errors << "Test " << name << " is listed more than once.\n"; 75 | continue; 76 | } 77 | 78 | bool found = false; 79 | for (RegisteredTestIter it = registered_tests_.begin(); 80 | it != registered_tests_.end(); 81 | ++it) { 82 | if (name == it->first) { 83 | found = true; 84 | break; 85 | } 86 | } 87 | 88 | if (found) { 89 | tests.insert(name); 90 | } else { 91 | errors << "No test named " << name 92 | << " can be found in this test suite.\n"; 93 | } 94 | } 95 | 96 | for (RegisteredTestIter it = registered_tests_.begin(); 97 | it != registered_tests_.end(); 98 | ++it) { 99 | if (tests.count(it->first) == 0) { 100 | errors << "You forgot to list test " << it->first << ".\n"; 101 | } 102 | } 103 | 104 | const std::string& errors_str = errors.GetString(); 105 | if (errors_str != "") { 106 | fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), 107 | errors_str.c_str()); 108 | fflush(stderr); 109 | posix::Abort(); 110 | } 111 | 112 | return registered_tests; 113 | } 114 | 115 | #endif // GTEST_HAS_TYPED_TEST_P 116 | 117 | } // namespace internal 118 | } // namespace testing 119 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/src/gtest-test-part.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // The Google C++ Testing and Mocking Framework (Google Test) 32 | 33 | #include "gtest/gtest-test-part.h" 34 | #include "src/gtest-internal-inl.h" 35 | 36 | namespace testing { 37 | 38 | using internal::GetUnitTestImpl; 39 | 40 | // Gets the summary of the failure message by omitting the stack trace 41 | // in it. 42 | std::string TestPartResult::ExtractSummary(const char* message) { 43 | const char* const stack_trace = strstr(message, internal::kStackTraceMarker); 44 | return stack_trace == nullptr ? message : std::string(message, stack_trace); 45 | } 46 | 47 | // Prints a TestPartResult object. 48 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { 49 | return os << result.file_name() << ":" << result.line_number() << ": " 50 | << (result.type() == TestPartResult::kSuccess 51 | ? "Success" 52 | : result.type() == TestPartResult::kSkip 53 | ? "Skipped" 54 | : result.type() == TestPartResult::kFatalFailure 55 | ? "Fatal failure" 56 | : "Non-fatal failure") 57 | << ":\n" 58 | << result.message() << std::endl; 59 | } 60 | 61 | // Appends a TestPartResult to the array. 62 | void TestPartResultArray::Append(const TestPartResult& result) { 63 | array_.push_back(result); 64 | } 65 | 66 | // Returns the TestPartResult at the given index (0-based). 67 | const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const { 68 | if (index < 0 || index >= size()) { 69 | printf("\nInvalid index (%d) into TestPartResultArray.\n", index); 70 | internal::posix::Abort(); 71 | } 72 | 73 | return array_[static_cast(index)]; 74 | } 75 | 76 | // Returns the number of TestPartResult objects in the array. 77 | int TestPartResultArray::size() const { 78 | return static_cast(array_.size()); 79 | } 80 | 81 | namespace internal { 82 | 83 | HasNewFatalFailureHelper::HasNewFatalFailureHelper() 84 | : has_new_fatal_failure_(false), 85 | original_reporter_(GetUnitTestImpl()-> 86 | GetTestPartResultReporterForCurrentThread()) { 87 | GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this); 88 | } 89 | 90 | HasNewFatalFailureHelper::~HasNewFatalFailureHelper() { 91 | GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread( 92 | original_reporter_); 93 | } 94 | 95 | void HasNewFatalFailureHelper::ReportTestPartResult( 96 | const TestPartResult& result) { 97 | if (result.fatally_failed()) 98 | has_new_fatal_failure_ = true; 99 | original_reporter_->ReportTestPartResult(result); 100 | } 101 | 102 | } // namespace internal 103 | 104 | } // namespace testing 105 | -------------------------------------------------------------------------------- /SolutionProjectModel/logTesting/spdlog/details/file_helper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Helper class for file sinks. 9 | // When failing to open a file, retry several times(5) with a delay interval(10 ms). 10 | // Throw spdlog_ex exception on errors. 11 | 12 | #include "spdlog/details/log_msg.h" 13 | #include "spdlog/details/os.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | namespace spdlog { 23 | namespace details { 24 | 25 | class file_helper 26 | { 27 | 28 | public: 29 | const int open_tries = 5; 30 | const int open_interval = 10; 31 | 32 | explicit file_helper() = default; 33 | 34 | file_helper(const file_helper &) = delete; 35 | file_helper &operator=(const file_helper &) = delete; 36 | 37 | ~file_helper() 38 | { 39 | close(); 40 | } 41 | 42 | void open(const filename_t &fname, bool truncate = false) 43 | { 44 | close(); 45 | auto *mode = truncate ? SPDLOG_FILENAME_T("wb") : SPDLOG_FILENAME_T("ab"); 46 | _filename = fname; 47 | for (int tries = 0; tries < open_tries; ++tries) 48 | { 49 | if (!os::fopen_s(&fd_, fname, mode)) 50 | { 51 | return; 52 | } 53 | 54 | details::os::sleep_for_millis(open_interval); 55 | } 56 | 57 | throw spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno); 58 | } 59 | 60 | void reopen(bool truncate) 61 | { 62 | if (_filename.empty()) 63 | { 64 | throw spdlog_ex("Failed re opening file - was not opened before"); 65 | } 66 | open(_filename, truncate); 67 | } 68 | 69 | void flush() 70 | { 71 | std::fflush(fd_); 72 | } 73 | 74 | void close() 75 | { 76 | if (fd_ != nullptr) 77 | { 78 | std::fclose(fd_); 79 | fd_ = nullptr; 80 | } 81 | } 82 | 83 | void write(const fmt::memory_buffer &buf) 84 | { 85 | size_t msg_size = buf.size(); 86 | auto data = buf.data(); 87 | if (std::fwrite(data, 1, msg_size, fd_) != msg_size) 88 | { 89 | throw spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno); 90 | } 91 | } 92 | 93 | size_t size() const 94 | { 95 | if (fd_ == nullptr) 96 | { 97 | throw spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename)); 98 | } 99 | return os::filesize(fd_); 100 | } 101 | 102 | const filename_t &filename() const 103 | { 104 | return _filename; 105 | } 106 | 107 | static bool file_exists(const filename_t &fname) 108 | { 109 | return os::file_exists(fname); 110 | } 111 | 112 | // 113 | // return file path and its extension: 114 | // 115 | // "mylog.txt" => ("mylog", ".txt") 116 | // "mylog" => ("mylog", "") 117 | // "mylog." => ("mylog.", "") 118 | // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt") 119 | // 120 | // the starting dot in filenames is ignored (hidden files): 121 | // 122 | // ".mylog" => (".mylog". "") 123 | // "my_folder/.mylog" => ("my_folder/.mylog", "") 124 | // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") 125 | static std::tuple split_by_extension(const spdlog::filename_t &fname) 126 | { 127 | auto ext_index = fname.rfind('.'); 128 | 129 | // no valid extension found - return whole path and empty string as 130 | // extension 131 | if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1) 132 | { 133 | return std::make_tuple(fname, spdlog::filename_t()); 134 | } 135 | 136 | // treat casese like "/etc/rc.d/somelogfile or "/abc/.hiddenfile" 137 | auto folder_index = fname.rfind(details::os::folder_sep); 138 | if (folder_index != filename_t::npos && folder_index >= ext_index - 1) 139 | { 140 | return std::make_tuple(fname, spdlog::filename_t()); 141 | } 142 | 143 | // finally - return a valid base and extension tuple 144 | return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index)); 145 | } 146 | 147 | private: 148 | std::FILE *fd_{nullptr}; 149 | filename_t _filename; 150 | }; 151 | } // namespace details 152 | } // namespace spdlog 153 | --------------------------------------------------------------------------------