summaryrefslogtreecommitdiff
path: root/elpa/irony-20220110.849/server/src/support
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-06-07 08:23:47 -0400
committermattkae <mattkae@protonmail.com>2022-06-07 08:23:47 -0400
commitbd18a38c2898548a3664a9ddab9f79c84f2caf4a (patch)
tree95b9933376770381bd8859782ae763be81c2d72b /elpa/irony-20220110.849/server/src/support
parentb07628dddf418d4f47b858e6c35fd3520fbaeed2 (diff)
parentef160dea332af4b4fe5e2717b962936c67e5fe9e (diff)
Merge conflict
Diffstat (limited to 'elpa/irony-20220110.849/server/src/support')
-rw-r--r--elpa/irony-20220110.849/server/src/support/CIndex.h33
-rw-r--r--elpa/irony-20220110.849/server/src/support/CommandLineParser.cpp119
-rw-r--r--elpa/irony-20220110.849/server/src/support/CommandLineParser.h21
-rw-r--r--elpa/irony-20220110.849/server/src/support/NonCopyable.h34
-rw-r--r--elpa/irony-20220110.849/server/src/support/TemporaryFile.cpp74
-rw-r--r--elpa/irony-20220110.849/server/src/support/TemporaryFile.h36
-rw-r--r--elpa/irony-20220110.849/server/src/support/iomanip_quoted.h52
7 files changed, 0 insertions, 369 deletions
diff --git a/elpa/irony-20220110.849/server/src/support/CIndex.h b/elpa/irony-20220110.849/server/src/support/CIndex.h
deleted file mode 100644
index 89d3f62..0000000
--- a/elpa/irony-20220110.849/server/src/support/CIndex.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * \file
- * \brief Wrapper around Clang Indexing Public C Interface header.
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#ifndef IRONY_MODE_SERVER_SUPPORT_CINDEXVERSION_H_
-#define IRONY_MODE_SERVER_SUPPORT_CINDEXVERSION_H_
-
-#include <clang-c/Index.h>
-
-/// Use <tt>\#if CINDEX_VERSION_VERSION > 10047</tt> to test for
-/// CINDEX_VERSION_MAJOR = 1 and CINDEX_VERSION_MINOR = 47.
-#ifndef CINDEX_VERSION
-#define CINDEX_VERSION 0 // pre-clang 3.2 support
-#endif
-
-#if CINDEX_VERSION >= 6
-#define HAS_BRIEF_COMMENTS_IN_COMPLETION 1
-#else
-#define HAS_BRIEF_COMMENTS_IN_COMPLETION 0
-#endif
-
-#if CINDEX_VERSION >= 6
-#define HAS_COMPILATION_DATABASE 1
-#include <clang-c/CXCompilationDatabase.h>
-#else
-#define HAS_COMPILATION_DATABASE 0
-#endif
-
-#endif /* !IRONY_MODE_SERVER_SUPPORT_CINDEXVERSION_H_ */
diff --git a/elpa/irony-20220110.849/server/src/support/CommandLineParser.cpp b/elpa/irony-20220110.849/server/src/support/CommandLineParser.cpp
deleted file mode 100644
index a838092..0000000
--- a/elpa/irony-20220110.849/server/src/support/CommandLineParser.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * \file
- * \author Guillaume Papin <guillaume.papin@epitech.eu>
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#include "CommandLineParser.h"
-
-namespace {
-
-/// \brief A parser for escaped strings of command line arguments.
-///
-/// Assumes \-escaping for quoted arguments (see the documentation of
-/// unescapeCommandLine(...)).
-class CommandLineArgumentParser {
-public:
- CommandLineArgumentParser(const std::string &commandLine)
- : input_(commandLine), position_(input_.begin() - 1) {
- }
-
- std::vector<std::string> parse() {
- bool hasMoreInput = true;
- while (hasMoreInput && nextNonWhitespace()) {
- std::string argument;
- hasMoreInput = parseStringInto(argument);
- commandLine_.push_back(argument);
- }
- return commandLine_;
- }
-
-private:
- // All private methods return true if there is more input available.
-
- bool parseStringInto(std::string &string) {
- do {
- if (*position_ == '"') {
- if (!parseDoubleQuotedStringInto(string))
- return false;
- } else if (*position_ == '\'') {
- if (!parseSingleQuotedStringInto(string))
- return false;
- } else {
- if (!parseFreeStringInto(string))
- return false;
- }
- } while (*position_ != ' ');
- return true;
- }
-
- bool parseDoubleQuotedStringInto(std::string &string) {
- if (!next())
- return false;
- while (*position_ != '"') {
- if (!skipEscapeCharacter())
- return false;
- string.push_back(*position_);
- if (!next())
- return false;
- }
- return next();
- }
-
- bool parseSingleQuotedStringInto(std::string &string) {
- if (!next())
- return false;
- while (*position_ != '\'') {
- string.push_back(*position_);
- if (!next())
- return false;
- }
- return next();
- }
-
- bool parseFreeStringInto(std::string &string) {
- do {
- if (!skipEscapeCharacter())
- return false;
- string.push_back(*position_);
- if (!next())
- return false;
- } while (*position_ != ' ' && *position_ != '"' && *position_ != '\'');
- return true;
- }
-
- bool skipEscapeCharacter() {
- if (*position_ == '\\') {
- return next();
- }
- return true;
- }
-
- bool nextNonWhitespace() {
- do {
- if (!next())
- return false;
- } while (*position_ == ' ');
- return true;
- }
-
- bool next() {
- ++position_;
- return position_ != input_.end();
- }
-
-private:
- const std::string input_;
- std::string::const_iterator position_;
- std::vector<std::string> commandLine_;
-};
-
-} // unnamed namespace
-
-std::vector<std::string>
-unescapeCommandLine(const std::string &escapedCommandLine) {
- CommandLineArgumentParser parser(escapedCommandLine);
- return parser.parse();
-}
diff --git a/elpa/irony-20220110.849/server/src/support/CommandLineParser.h b/elpa/irony-20220110.849/server/src/support/CommandLineParser.h
deleted file mode 100644
index b764797..0000000
--- a/elpa/irony-20220110.849/server/src/support/CommandLineParser.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * \file
- * \brief Facility to parse a command line into a string array.
- *
- * \note Please note that the code borrowed from the Clang,
- * lib/Tooling/JSONCompilationDatabase.cpp.
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#ifndef IRONY_MODE_SERVER_SUPPORT_COMMAND_LINE_PARSER_H_
-#define IRONY_MODE_SERVER_SUPPORT_COMMAND_LINE_PARSER_H_
-
-#include <string>
-#include <vector>
-
-std::vector<std::string>
-unescapeCommandLine(const std::string &escapedCommandLine);
-
-#endif // IRONY_MODE_SERVER_SUPPORT_COMMAND_LINE_PARSER_H_
diff --git a/elpa/irony-20220110.849/server/src/support/NonCopyable.h b/elpa/irony-20220110.849/server/src/support/NonCopyable.h
deleted file mode 100644
index d30a5b2..0000000
--- a/elpa/irony-20220110.849/server/src/support/NonCopyable.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/**-*-C++-*-
- * \file
- * \author Guillaume Papin <guillaume.papin@epitech.eu>
- *
- * \brief NonCopyable class like in Boost.
- *
- * \see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Non-copyable_Mixin
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#ifndef IRONY_MODE_SERVER_SUPPORT_NONCOPYABLE_H_
-#define IRONY_MODE_SERVER_SUPPORT_NONCOPYABLE_H_
-
-namespace util {
-
-class NonCopyable {
-protected:
- NonCopyable() {
- }
-
- // Protected non-virtual destructor
- ~NonCopyable() {
- }
-
-private:
- NonCopyable(const NonCopyable &);
- NonCopyable &operator=(const NonCopyable &);
-};
-
-} // ! namespace util
-
-#endif /* !IRONY_MODE_SERVER_SUPPORT_NONCOPYABLE_H_ */
diff --git a/elpa/irony-20220110.849/server/src/support/TemporaryFile.cpp b/elpa/irony-20220110.849/server/src/support/TemporaryFile.cpp
deleted file mode 100644
index e7393e1..0000000
--- a/elpa/irony-20220110.849/server/src/support/TemporaryFile.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * \file
- * \author Guillaume Papin <guillaume.papin@epitech.eu>
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#include "TemporaryFile.h"
-
-#include <algorithm>
-#include <cstdio>
-#include <cstdlib>
-#include <fstream>
-#include <iostream>
-#include <random>
-
-static std::string getTemporaryFileDirectory() {
- const char *temporaryDirEnvVars[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
-
- for (const char *envVar : temporaryDirEnvVars) {
- if (const char *dir = std::getenv(envVar))
- return dir;
- }
-
- return "/tmp";
-}
-
-TemporaryFile::TemporaryFile(const std::string &prefix,
- const std::string &suffix)
- : pathOrPattern_(prefix + "-%%%%%%" + suffix) {
-}
-
-TemporaryFile::~TemporaryFile() {
- if (openedFile_) {
- openedFile_.reset();
- std::remove(pathOrPattern_.c_str());
- }
-}
-
-const std::string &TemporaryFile::getPath() {
- if (!openedFile_) {
- openedFile_.reset(new std::fstream);
-
- std::random_device rd;
- std::default_random_engine e(rd());
- std::uniform_int_distribution<int> dist(0, 15);
- std::string pattern = pathOrPattern_;
- std::string tmpDir = getTemporaryFileDirectory() + "/";
- int i = 0;
-
- do {
- // exiting is better than infinite loop
- if (++i > TemporaryFile::MAX_ATTEMPS) {
- std::cerr << "error: couldn't create temporary file, please check your "
- "temporary file directory (" << tmpDir << ")\n";
- exit(EXIT_FAILURE);
- }
-
- // make the filename based on the pattern
- std::transform(pattern.begin(),
- pattern.end(),
- pathOrPattern_.begin(),
- [&e, &dist](char ch) {
- return ch == '%' ? "0123456789abcdef"[dist(e)] : ch;
- });
- // create the file
- openedFile_->open(tmpDir + pathOrPattern_, std::ios_base::out);
- } while (!openedFile_->is_open());
- pathOrPattern_ = tmpDir + pathOrPattern_;
- }
-
- return pathOrPattern_;
-}
diff --git a/elpa/irony-20220110.849/server/src/support/TemporaryFile.h b/elpa/irony-20220110.849/server/src/support/TemporaryFile.h
deleted file mode 100644
index 5bf77f4..0000000
--- a/elpa/irony-20220110.849/server/src/support/TemporaryFile.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**-*-C++-*-
- * \file
- * \author Guillaume Papin <guillaume.papin@epitech.eu>
- *
- * \brief Not the best piece of code out there.
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#ifndef IRONY_MODE_SERVER_SUPPORT_TEMPORARY_FILE_H_
-#define IRONY_MODE_SERVER_SUPPORT_TEMPORARY_FILE_H_
-
-#include <iosfwd>
-#include <memory>
-#include <string>
-
-class TemporaryFile {
- enum {
- // if we can't create the temp file, exits.
- MAX_ATTEMPS = 25
- };
-
-public:
- TemporaryFile(const std::string &prefix, const std::string &suffix = "");
- ~TemporaryFile();
-
- /// Returns the path of this temporary filename
- const std::string &getPath();
-
-private:
- std::string pathOrPattern_;
- std::unique_ptr<std::fstream> openedFile_;
-};
-
-#endif // IRONY_MODE_SERVER_SUPPORT_TEMPORARY_FILE_H_
diff --git a/elpa/irony-20220110.849/server/src/support/iomanip_quoted.h b/elpa/irony-20220110.849/server/src/support/iomanip_quoted.h
deleted file mode 100644
index a8ca38b..0000000
--- a/elpa/irony-20220110.849/server/src/support/iomanip_quoted.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**-*-C++-*-
- * \file
- * \brief Dumb implementation of something that might look like C++14
- * std::quoted.
- *
- * This file is distributed under the GNU General Public License. See
- * COPYING for details.
- */
-
-#ifndef IRONY_MODE_SERVER_SUPPORT_IOMANIP_QUOTED_H_
-#define IRONY_MODE_SERVER_SUPPORT_IOMANIP_QUOTED_H_
-
-#include <ostream>
-#include <string>
-
-namespace support {
-namespace detail {
-
-struct QuotedStringProxy {
- QuotedStringProxy(const std::string &s) : s(s) {
- }
-
- std::string s;
-};
-
-std::ostream &operator<<(std::ostream &os, const QuotedStringProxy &q) {
- const std::string &s = q.s;
-
- os << '"';
- if (s.find_first_of("\"\\") == std::string::npos) {
- os << s;
- } else {
- for (auto ch : s) {
- if (ch == '\\' || ch == '"')
- os << '\\';
-
- os << ch;
- }
- }
- os << '"';
- return os;
-}
-
-} // namespace detail
-
-detail::QuotedStringProxy quoted(const std::string &s) {
- return detail::QuotedStringProxy(s);
-}
-
-} // namespace support
-
-#endif // IRONY_MODE_SERVER_SUPPORT_IOMANIP_QUOTED_H_