From 67554ef3b02dc0833b4ca76c1a8c40fbfabbb238 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 5 May 2020 18:17:50 -0700 Subject: [PATCH] [build] Add .inl files to styleguide (NFC) (#2506) No functional changes. --- .styleguide | 1 + cscore/.styleguide | 1 + cscore/src/main/native/include/cscore_oo.inl | 58 +++++++++++-------- ntcore/.styleguide | 1 + .../networktables/NetworkTableEntry.inl | 12 ++-- .../networktables/NetworkTableInstance.inl | 11 ++-- .../native/include/networktables/RpcCall.inl | 11 ++-- wpiutil/.styleguide | 1 + .../src/main/native/include/wpi/HttpUtil.inl | 10 ++-- 9 files changed, 66 insertions(+), 40 deletions(-) diff --git a/.styleguide b/.styleguide index 8a98b1b7c1..e05779bf6e 100644 --- a/.styleguide +++ b/.styleguide @@ -2,6 +2,7 @@ cppHeaderFileInclude { \.h$ \.hpp$ \.inc$ + \.inl$ } cppSrcFileInclude { diff --git a/cscore/.styleguide b/cscore/.styleguide index f38c85000a..fada841611 100644 --- a/cscore/.styleguide +++ b/cscore/.styleguide @@ -6,6 +6,7 @@ cppHeaderFileInclude { (? +#include +#include namespace cs { @@ -76,7 +80,7 @@ inline VideoProperty::VideoProperty(CS_Property handle) : m_handle(handle) { } inline VideoProperty::VideoProperty(CS_Property handle, Kind kind) - : m_status(0), m_handle(handle), m_kind(kind) {} + : m_status(0), m_handle(handle), m_kind(kind) {} inline VideoSource::VideoSource(const VideoSource& source) : m_handle(source.m_handle == 0 ? 0 @@ -394,10 +398,10 @@ inline void ImageSource::SetDescription(const wpi::Twine& description) { } inline VideoProperty ImageSource::CreateProperty(const wpi::Twine& name, - VideoProperty::Kind kind, - int minimum, int maximum, - int step, int defaultValue, - int value) { + VideoProperty::Kind kind, + int minimum, int maximum, + int step, int defaultValue, + int value) { m_status = 0; return VideoProperty{CreateSourceProperty( m_handle, name, static_cast(static_cast(kind)), @@ -405,35 +409,41 @@ inline VideoProperty ImageSource::CreateProperty(const wpi::Twine& name, } inline VideoProperty ImageSource::CreateIntegerProperty(const wpi::Twine& name, - int minimum, int maximum, - int step, int defaultValue, - int value) { + int minimum, + int maximum, int step, + int defaultValue, + int value) { m_status = 0; return VideoProperty{CreateSourceProperty( - m_handle, name, static_cast(static_cast(VideoProperty::Kind::kInteger)), + m_handle, name, + static_cast( + static_cast(VideoProperty::Kind::kInteger)), minimum, maximum, step, defaultValue, value, &m_status)}; } inline VideoProperty ImageSource::CreateBooleanProperty(const wpi::Twine& name, - bool defaultValue, - bool value) { + bool defaultValue, + bool value) { m_status = 0; return VideoProperty{CreateSourceProperty( - m_handle, name, static_cast(static_cast(VideoProperty::Kind::kBoolean)), + m_handle, name, + static_cast( + static_cast(VideoProperty::Kind::kBoolean)), 0, 1, 1, defaultValue ? 1 : 0, value ? 1 : 0, &m_status)}; } -inline VideoProperty ImageSource::CreateStringProperty(const wpi::Twine& name, - const wpi::Twine& value) { +inline VideoProperty ImageSource::CreateStringProperty( + const wpi::Twine& name, const wpi::Twine& value) { m_status = 0; - auto prop = VideoProperty{CreateSourceProperty( - m_handle, name, static_cast(static_cast(VideoProperty::Kind::kString)), - 0, 0, 0, 0, 0, &m_status)}; + auto prop = VideoProperty{ + CreateSourceProperty(m_handle, name, + static_cast( + static_cast(VideoProperty::Kind::kString)), + 0, 0, 0, 0, 0, &m_status)}; prop.SetString(value); return prop; } - inline void ImageSource::SetEnumPropertyChoices( const VideoProperty& property, wpi::ArrayRef choices) { m_status = 0; @@ -441,8 +451,8 @@ inline void ImageSource::SetEnumPropertyChoices( } template -inline void ImageSource::SetEnumPropertyChoices(const VideoProperty& property, - std::initializer_list choices) { +inline void ImageSource::SetEnumPropertyChoices( + const VideoProperty& property, std::initializer_list choices) { std::vector vec; vec.reserve(choices.size()); for (const auto& choice : choices) vec.emplace_back(choice); @@ -618,4 +628,4 @@ inline VideoListener::~VideoListener() { } // namespace cs -#endif /* CSCORE_OO_INL_ */ +#endif // CSCORE_CSCORE_OO_INL_ diff --git a/ntcore/.styleguide b/ntcore/.styleguide index 4c00fa9af9..67befdb7dd 100644 --- a/ntcore/.styleguide +++ b/ntcore/.styleguide @@ -5,6 +5,7 @@ cHeaderFileInclude { cppHeaderFileInclude { (? +#include +#include namespace nt { @@ -295,4 +299,4 @@ inline void NetworkTableEntry::RemoveListener(NT_EntryListener entry_listener) { } // namespace nt -#endif // NT_ENTRY_INL_ +#endif // NTCORE_NETWORKTABLES_NETWORKTABLEENTRY_INL_ diff --git a/ntcore/src/main/native/include/networktables/NetworkTableInstance.inl b/ntcore/src/main/native/include/networktables/NetworkTableInstance.inl index 2b6607f18f..5321e83535 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableInstance.inl +++ b/ntcore/src/main/native/include/networktables/NetworkTableInstance.inl @@ -1,12 +1,15 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017. All Rights Reserved. */ +/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef NT_INSTANCE_INL_ -#define NT_INSTANCE_INL_ +#ifndef NTCORE_NETWORKTABLES_NETWORKTABLEINSTANCE_INL_ +#define NTCORE_NETWORKTABLES_NETWORKTABLEINSTANCE_INL_ + +#include +#include namespace nt { @@ -188,4 +191,4 @@ inline bool NetworkTableInstance::WaitForLoggerQueue(double timeout) { } // namespace nt -#endif // NT_INSTANCE_INL_ +#endif // NTCORE_NETWORKTABLES_NETWORKTABLEINSTANCE_INL_ diff --git a/ntcore/src/main/native/include/networktables/RpcCall.inl b/ntcore/src/main/native/include/networktables/RpcCall.inl index 0e9b52297b..faf305d81c 100644 --- a/ntcore/src/main/native/include/networktables/RpcCall.inl +++ b/ntcore/src/main/native/include/networktables/RpcCall.inl @@ -1,12 +1,15 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2017. All Rights Reserved. */ +/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef NT_RPCCALL_INL_ -#define NT_RPCCALL_INL_ +#ifndef NTCORE_NETWORKTABLES_RPCCALL_INL_ +#define NTCORE_NETWORKTABLES_RPCCALL_INL_ + +#include +#include #include "ntcore_cpp.h" @@ -45,4 +48,4 @@ inline void RpcCall::CancelResult() { } // namespace nt -#endif // NT_RPCCALL_INL_ +#endif // NTCORE_NETWORKTABLES_RPCCALL_INL_ diff --git a/wpiutil/.styleguide b/wpiutil/.styleguide index 134c65d0c1..409ea0688e 100644 --- a/wpiutil/.styleguide +++ b/wpiutil/.styleguide @@ -1,6 +1,7 @@ cppHeaderFileInclude { \.h$ \.inc$ + \.inl$ } cppSrcFileInclude { diff --git a/wpiutil/src/main/native/include/wpi/HttpUtil.inl b/wpiutil/src/main/native/include/wpi/HttpUtil.inl index ce118b0a38..c6d6ed4330 100644 --- a/wpiutil/src/main/native/include/wpi/HttpUtil.inl +++ b/wpiutil/src/main/native/include/wpi/HttpUtil.inl @@ -1,12 +1,14 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2015. All Rights Reserved. */ +/* Copyright (c) 2015-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ -#ifndef WPIUTIL_SUPPORT_HTTPUTIL_INL_ -#define WPIUTIL_SUPPORT_HTTPUTIL_INL_ +#ifndef WPIUTIL_WPI_HTTPUTIL_INL_ +#define WPIUTIL_WPI_HTTPUTIL_INL_ + +#include namespace wpi { @@ -45,4 +47,4 @@ void HttpRequest::SetPath(StringRef path_, const T& params) { } // namespace wpi -#endif // WPIUTIL_SUPPORT_HTTPUTIL_INL_ +#endif // WPIUTIL_WPI_HTTPUTIL_INL_