Add newline at EOF (#1932)

This commit is contained in:
Ken Matsui 2024-01-30 18:43:30 -08:00 committed by GitHub
parent 674137e89d
commit 56a53165b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 58 additions and 57 deletions

View File

@ -75,6 +75,7 @@ IndentCaseLabels: true
IndentPPDirectives: None IndentPPDirectives: None
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave JavaScriptQuotes: Leave
JavaScriptWrapImports: true JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false

View File

@ -468,4 +468,4 @@ void create_controller::createARestfulController(const std::string &className,
<< std::endl; << std::endl;
std::cout << "File name: " << ctlName << ".h and " << ctlName << ".cc" std::cout << "File name: " << ctlName << ".h and " << ctlName << ".cc"
<< std::endl; << std::endl;
} }

View File

@ -8,4 +8,4 @@ void JsonCtrl::asyncHandleHttpRequest(
ret["message"] = "Hello, World!"; ret["message"] = "Hello, World!";
auto resp = HttpResponse::newHttpJsonResponse(ret); auto resp = HttpResponse::newHttpJsonResponse(ret);
callback(resp); callback(resp);
} }

View File

@ -43,4 +43,4 @@ int main()
.setUploadPath("./uploads") .setUploadPath("./uploads")
.addListener("127.0.0.1", 8848) .addListener("127.0.0.1", 8848)
.run(); .run();
} }

View File

@ -37,4 +37,4 @@ class SayHello : public HttpController<SayHello>
"Hi there, this is another hello from the SayHello Controller"); "Hi there, this is another hello from the SayHello Controller");
callback(resp); callback(resp);
} }
}; };

View File

@ -26,4 +26,4 @@ class HelloViewController : public HttpSimpleController<HelloViewController>
auto resp = HttpResponse::newHttpViewResponse("HelloView", data); auto resp = HttpResponse::newHttpViewResponse("HelloView", data);
callback(resp); callback(resp);
} }
}; };

View File

@ -211,4 +211,4 @@ class JsonStore : public HttpController<JsonStore>
int main() int main()
{ {
app().addListener("127.0.0.1", 8848).run(); app().addListener("127.0.0.1", 8848).run();
} }

View File

@ -65,4 +65,4 @@ int main()
.enableSession(24h) .enableSession(24h)
.addListener("127.0.0.1", 8848) .addListener("127.0.0.1", 8848)
.run(); .run();
} }

View File

@ -11,4 +11,4 @@ template <>
inline std::string toString<trantor::Date>(const trantor::Date &date) inline std::string toString<trantor::Date>(const trantor::Date &date)
{ {
return std::to_string(date.microSecondsSinceEpoch()); return std::to_string(date.microSecondsSinceEpoch());
} }

View File

@ -70,4 +70,4 @@ void TimeFilter::doFilter(const HttpRequestPtr &req,
co_return; co_return;
} }
}); });
} }

View File

@ -97,4 +97,4 @@ void SimpleReverseProxy::preRouting(const HttpRequestPtr &req,
callback(errResp); callback(errResp);
} }
}); });
} }

View File

@ -70,4 +70,4 @@ void WebSocketChat::handleNewConnection(const HttpRequestPtr &req,
int main() int main()
{ {
app().addListener("127.0.0.1", 8848).run(); app().addListener("127.0.0.1", 8848).run();
} }

View File

@ -116,4 +116,4 @@ class DROGON_EXPORT Redirector : public drogon::Plugin<Redirector>,
}; };
} // namespace plugin } // namespace plugin
} // namespace drogon } // namespace drogon

View File

@ -144,4 +144,4 @@ class OStringStream
private: private:
std::string buffer_; std::string buffer_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -15,4 +15,4 @@
#include <drogon/utils/monitoring/Metric.h> #include <drogon/utils/monitoring/Metric.h>
#include <drogon/utils/monitoring/Registry.h> #include <drogon/utils/monitoring/Registry.h>
#include <drogon/utils/monitoring/Collector.h> #include <drogon/utils/monitoring/Collector.h>
#include <drogon/utils/monitoring/Sample.h> #include <drogon/utils/monitoring/Sample.h>

View File

@ -129,4 +129,4 @@ class Collector : public CollectorBase
mutable std::mutex mutex_; mutable std::mutex mutex_;
}; };
} // namespace monitoring } // namespace monitoring
} // namespace drogon } // namespace drogon

View File

@ -106,4 +106,4 @@ class Gauge : public Metric
trantor::Date timestamp_{0}; trantor::Date timestamp_{0};
}; };
} // namespace monitoring } // namespace monitoring
} // namespace drogon } // namespace drogon

View File

@ -74,4 +74,4 @@ class Metric : public std::enable_shared_from_this<Metric>
using MetricPtr = std::shared_ptr<Metric>; using MetricPtr = std::shared_ptr<Metric>;
} // namespace monitoring } // namespace monitoring
} // namespace drogon } // namespace drogon

View File

@ -32,4 +32,4 @@ class Registry
const std::shared_ptr<CollectorBase> &collector) = 0; const std::shared_ptr<CollectorBase> &collector) = 0;
}; };
} // namespace monitoring } // namespace monitoring
} // namespace drogon } // namespace drogon

View File

@ -32,4 +32,4 @@ struct Sample
std::vector<std::pair<std::string, std::string>> exLabels; std::vector<std::pair<std::string, std::string>> exLabels;
}; };
} // namespace monitoring } // namespace monitoring
} // namespace drogon } // namespace drogon

View File

@ -72,4 +72,4 @@ class LifeTimeWatch
StopWatch stopWatch_; StopWatch stopWatch_;
std::function<void(double)> callback_; std::function<void(double)> callback_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -18,4 +18,4 @@ class ConfigAdapter
using ConfigAdapterPtr = std::shared_ptr<ConfigAdapter>; using ConfigAdapterPtr = std::shared_ptr<ConfigAdapter>;
} // namespace drogon } // namespace drogon

View File

@ -37,4 +37,4 @@ ConfigAdapterManager::ConfigAdapterManager()
{ {
REGISTER_CONFIG_ADAPTER(JsonConfigAdapter); REGISTER_CONFIG_ADAPTER(JsonConfigAdapter);
REGISTER_CONFIG_ADAPTER(YamlConfigAdapter); REGISTER_CONFIG_ADAPTER(YamlConfigAdapter);
} }

View File

@ -16,4 +16,4 @@ class ConfigAdapterManager
ConfigAdapterManager(); ConfigAdapterManager();
std::map<std::string, ConfigAdapterPtr> adapters_; std::map<std::string, ConfigAdapterPtr> adapters_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -55,4 +55,4 @@ bool DbClientManager::areAllDbClientsAvailable() const noexcept
DbClientManager::~DbClientManager() DbClientManager::~DbClientManager()
{ {
} }

View File

@ -29,4 +29,4 @@ bool FixedWindowRateLimiter::isAllowed()
return true; return true;
} }
return false; return false;
} }

View File

@ -105,4 +105,4 @@ void GlobalFilters::initAndStart(const Json::Value &config)
void GlobalFilters::shutdown() void GlobalFilters::shutdown()
{ {
filters_.clear(); filters_.clear();
} }

View File

@ -77,4 +77,4 @@ std::vector<Sample> Histogram::collect() const
countSample.value = totalCount; countSample.value = totalCount;
samples.emplace_back(std::move(countSample)); samples.emplace_back(std::move(countSample));
return samples; return samples;
} }

View File

@ -26,4 +26,4 @@ void handleException(const std::exception &e,
app().getExceptionHandler()(e, req, std::move(callback)); app().getExceptionHandler()(e, req, std::move(callback));
} }
} // namespace internal } // namespace internal
} // namespace drogon } // namespace drogon

View File

@ -730,4 +730,4 @@ void HttpClientImpl::addSSLConfigs(
{ {
sslConfCmds_.push_back(cmd); sslConfCmds_.push_back(cmd);
} }
} }

View File

@ -44,4 +44,4 @@ std::string HttpViewData::htmlTranslate(const char *str, size_t length)
++str; ++str;
} }
return ret; return ret;
} }

View File

@ -12,4 +12,4 @@ class JsonConfigAdapter : public ConfigAdapter
noexcept(false) override; noexcept(false) override;
std::vector<std::string> getExtensions() const override; std::vector<std::string> getExtensions() const override;
}; };
} // namespace drogon } // namespace drogon

View File

@ -118,4 +118,4 @@ std::shared_ptr<PluginBase> PluginsManager::getSharedPlugin(
return iter->second; return iter->second;
} }
return nullptr; return nullptr;
} }

View File

@ -51,4 +51,4 @@ void RedisClientManager::createRedisClient(const std::string & /*name*/,
RedisClientManager::~RedisClientManager() RedisClientManager::~RedisClientManager()
{ {
} }

View File

@ -69,4 +69,4 @@ bool RedisResult::isNil() const noexcept
abort(); abort();
} }
} // namespace nosql } // namespace nosql
} // namespace drogon } // namespace drogon

View File

@ -20,4 +20,4 @@ class SlidingWindowRateLimiter : public RateLimiter
std::chrono::steady_clock::time_point lastTime_; std::chrono::steady_clock::time_point lastTime_;
std::chrono::duration<double> timeUnit_; std::chrono::duration<double> timeUnit_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -38,4 +38,4 @@ void TaskTimeoutFlag::runTimer()
bool TaskTimeoutFlag::done() bool TaskTimeoutFlag::done()
{ {
return isDone_.exchange(true); return isDone_.exchange(true);
} }

View File

@ -36,4 +36,4 @@ class TaskTimeoutFlag : public trantor::NonCopyable,
std::chrono::duration<double> timeout_; std::chrono::duration<double> timeout_;
std::function<void()> timeoutFunc_; std::function<void()> timeoutFunc_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -12,4 +12,4 @@ class YamlConfigAdapter : public ConfigAdapter
noexcept(false) override; noexcept(false) override;
std::vector<std::string> getExtensions() const override; std::vector<std::string> getExtensions() const override;
}; };
} // namespace drogon } // namespace drogon

View File

@ -214,4 +214,4 @@ void DigestAuthFilter::doFilter(const HttpRequestPtr &req,
"\", opaque=\"" + opaque + "\""); "\", opaque=\"" + opaque + "\"");
cb(resp); cb(resp);
return; return;
} }

View File

@ -30,4 +30,4 @@ class DigestAuthFilter : public drogon::HttpFilter<DigestAuthFilter, false>
virtual void doFilter(const HttpRequestPtr &req, virtual void doFilter(const HttpRequestPtr &req,
FilterCallback &&cb, FilterCallback &&cb,
FilterChainCallback &&ccb) override; FilterChainCallback &&ccb) override;
}; };

View File

@ -11,4 +11,4 @@ void ForwardCtrl::asyncHandleHttpRequest(
callback(resp); callback(resp);
}, },
"https://api.github.com"); "https://api.github.com");
} }

View File

@ -53,4 +53,4 @@ void MethodTest::postRegex(
{ {
LOG_DEBUG << regStr; LOG_DEBUG << regStr;
makePostRespose(callback); makePostRespose(callback);
} }

View File

@ -45,4 +45,4 @@ void TimeFilter::doFilter(const HttpRequestPtr &req,
LOG_TRACE << "first visit,insert visitDate"; LOG_TRACE << "first visit,insert visitDate";
req->session()->insert(VDate, now); req->session()->insert(VDate, now);
ccb(); ccb();
} }

View File

@ -526,4 +526,4 @@ void ApiTest::echoBody(const HttpRequestPtr &req,
auto resp = HttpResponse::newHttpResponse(); auto resp = HttpResponse::newHttpResponse();
resp->setBody(std::string(req->body())); resp->setBody(std::string(req->body()));
callback(resp); callback(resp);
} }

View File

@ -26,4 +26,4 @@ DROGON_TEST(ClassName)
CHECK(h.className() == "api::v1::hh"); CHECK(h.className() == "api::v1::hh");
CHECK(api::v1::hh::classTypeName() == "api::v1::hh"); CHECK(api::v1::hh::classTypeName() == "api::v1::hh");
CHECK(h.name() == "api::v1::hh"); CHECK(h.name() == "api::v1::hh");
} }

View File

@ -45,4 +45,4 @@ DROGON_TEST(ControllerCreation)
REQUIRE(Ctrl::created == false); REQUIRE(Ctrl::created == false);
REQUIRE(SimpleCtrl::created == false); REQUIRE(SimpleCtrl::created == false);
REQUIRE(WsCtrl::created == false); REQUIRE(WsCtrl::created == false);
} }

View File

@ -40,4 +40,4 @@ DROGON_TEST(DrObjectNamespaceTest)
auto objPtr2 = DrClassMap::getSingleInstance<::test::TestB>(); auto objPtr2 = DrClassMap::getSingleInstance<::test::TestB>();
CHECK(objPtr2.get() != nullptr); CHECK(objPtr2.get() != nullptr);
CHECK(objPtr == objPtr2); CHECK(objPtr == objPtr2);
} }

View File

@ -39,4 +39,4 @@ DROGON_TEST(FileTypeTest)
CHECK(parseFileType("") == FT_UNKNOWN); CHECK(parseFileType("") == FT_UNKNOWN);
CHECK(parseFileType("don'tknow") == FT_CUSTOM); CHECK(parseFileType("don'tknow") == FT_CUSTOM);
} }
} }

View File

@ -316,4 +316,4 @@ DROGON_TEST(Gzip)
auto decompressStr = utils::gzipDecompress(ret.data(), ret.length()); auto decompressStr = utils::gzipDecompress(ret.data(), ret.length());
CHECK(inStr == decompressStr); CHECK(inStr == decompressStr);
} }

View File

@ -56,4 +56,4 @@ DROGON_TEST(OStringStreamTest)
CHECK(ss.str() == "hello world!1233.14"); CHECK(ss.str() == "hello world!1233.14");
} }
} }

View File

@ -9,4 +9,4 @@ DROGON_TEST(SHA1Test)
"678901234567890123456789012345678901234567890"; "678901234567890123456789012345678901234567890";
auto str = drogon::utils::getSha1(in, strlen((const char *)in)); auto str = drogon::utils::getSha1(in, strlen((const char *)in));
CHECK(str == "FECFD28BBC9345891A66D7C1B8FF46E60192D284"); CHECK(str == "FECFD28BBC9345891A66D7C1B8FF46E60192D284");
} }

View File

@ -66,4 +66,4 @@ class RedisException final : public std::exception
using RedisExceptionCallback = std::function<void(const RedisException &)>; using RedisExceptionCallback = std::function<void(const RedisException &)>;
} // namespace nosql } // namespace nosql
} // namespace drogon } // namespace drogon

View File

@ -68,4 +68,4 @@ class RedisTransactionImpl final
double timeout_{-1.0}; double timeout_{-1.0};
}; };
} // namespace nosql } // namespace nosql
} // namespace drogon } // namespace drogon

View File

@ -180,4 +180,4 @@ class DROGON_EXPORT RestfulController : trantor::NonCopyable
std::unordered_map<std::string, size_t> masqueradingMap_; std::unordered_map<std::string, size_t> masqueradingMap_;
const std::vector<std::string> columnsVector_; const std::vector<std::string> columnsVector_;
}; };
} // namespace drogon } // namespace drogon

View File

@ -80,4 +80,4 @@ orm::Criteria RestfulController::makeCriteria(
} }
} }
return ret; return ret;
} }

View File

@ -125,4 +125,4 @@ int main()
}; };
LOG_TRACE << "end"; LOG_TRACE << "end";
getchar(); getchar();
} }

View File

@ -50,4 +50,4 @@ class Sqlite3ResultImpl : public ResultImpl
size_t insertId_{0}; size_t insertId_{0};
}; };
} // namespace orm } // namespace orm
} // namespace drogon } // namespace drogon