diff --git a/audofeed-device-backend/CMakeLists.txt b/audofeed-device-backend/CMakeLists.txt new file mode 100644 index 0000000..71a8c3b --- /dev/null +++ b/audofeed-device-backend/CMakeLists.txt @@ -0,0 +1,207 @@ +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# cmake build file for C++ helloworld example. +# Assumes protobuf and gRPC have been installed using cmake. +# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build +# that automatically builds all the dependencies before building IM.Login. + +cmake_minimum_required(VERSION 3.5.1) + +project(device-backend C CXX) + +set (CMAKE_CXX_STANDARD 20) + +if(MSVC) + add_definitions(-D_WIN32_WINNT=0x600) +endif() + +find_package(Threads REQUIRED) + +if(GRPC_AS_SUBMODULE) + # One way to build a projects that uses gRPC is to just include the + # entire gRPC project tree via "add_subdirectory". + # This approach is very simple to use, but the are some potential + # disadvantages: + # * it includes gRPC's CMakeLists.txt directly into your build script + # without and that can make gRPC's internal setting interfere with your + # own build. + # * depending on what's installed on your system, the contents of submodules + # in gRPC's third_party/* might need to be available (and there might be + # additional prerequisites required to build them). Consider using + # the gRPC_*_PROVIDER options to fine-tune the expected behavior. + # + # A more robust approach to add dependency on gRPC is using + # cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt). + + # Include the gRPC's cmake build (normally grpc source code would live + # in a git submodule called "third_party/grpc", but this example lives in + # the same repository as gRPC sources, so we just look a few directories up) + add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) + message(STATUS "Using gRPC via add_subdirectory.") + + # After using add_subdirectory, we can now use the grpc targets directly from + # this build. + set(_PROTOBUF_LIBPROTOBUF libprotobuf) + set(_REFLECTION grpc++_reflection) + if(CMAKE_CROSSCOMPILING) + find_program(_PROTOBUF_PROTOC protoc) + else() + set(_PROTOBUF_PROTOC $) + endif() + set(_GRPC_GRPCPP grpc++) + if(CMAKE_CROSSCOMPILING) + find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) + else() + set(_GRPC_CPP_PLUGIN_EXECUTABLE $) + endif() +elseif(GRPC_FETCHCONTENT) + # Another way is to use CMake's FetchContent module to clone gRPC at + # configure time. This makes gRPC's source code available to your project, + # similar to a git submodule. + message(STATUS "Using gRPC via add_subdirectory (FetchContent).") + include(FetchContent) + FetchContent_Declare( + grpc + GIT_REPOSITORY https://github.com/grpc/grpc.git + # when using gRPC, you will actually set this to an existing tag, such as + # v1.25.0, v1.26.0 etc.. + # For the purpose of testing, we override the tag used to the commit + # that's currently under test. + GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE) + FetchContent_MakeAvailable(grpc) + + # Since FetchContent uses add_subdirectory under the hood, we can use + # the grpc targets directly from this build. + set(_PROTOBUF_LIBPROTOBUF libprotobuf) + set(_REFLECTION grpc++_reflection) + set(_PROTOBUF_PROTOC $) + set(_GRPC_GRPCPP grpc++) + if(CMAKE_CROSSCOMPILING) + find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) + else() + set(_GRPC_CPP_PLUGIN_EXECUTABLE $) + endif() +else() + # This branch assumes that gRPC and all its dependencies are already installed + # on this system, so they can be located by find_package(). + + # Find Protobuf installation + # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. + set(protobuf_MODULE_COMPATIBLE TRUE) + find_package(Protobuf CONFIG REQUIRED) + message(STATUS "Using protobuf ${Protobuf_VERSION}") + + set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) + set(_REFLECTION gRPC::grpc++_reflection) + if(CMAKE_CROSSCOMPILING) + find_program(_PROTOBUF_PROTOC protoc) + else() + set(_PROTOBUF_PROTOC $) + endif() + + # Find gRPC installation + # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. + find_package(gRPC CONFIG REQUIRED) + message(STATUS "Using gRPC ${gRPC_VERSION}") + + set(_GRPC_GRPCPP gRPC::grpc++) + if(CMAKE_CROSSCOMPILING) + find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) + else() + set(_GRPC_CPP_PLUGIN_EXECUTABLE $) + endif() +endif() + +SET(CMAKE_BUILD_TYPE "Debug") +SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") +SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall") + +# Proto files (自动匹配 proto 目录下的所有 .proto) +file(GLOB_RECURSE PROTO_FILES CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/proto/*.proto" +) +list(SORT PROTO_FILES) +set(PROTO_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/proto") +set(PROTO_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}") + +# Generated sources +set(PROTO_SRCS "") +set(PROTO_HDRS "") +set(GRPC_SRCS "") +set(GRPC_HDRS "") + + +foreach(proto_file ${PROTO_FILES}) + # NAME_WE 会截断多后缀(如 .Status.proto -> Local),这里手动只去掉 .proto + get_filename_component(proto_filename "${proto_file}" NAME) + string(REGEX REPLACE "\\.proto$" "" proto_name "${proto_filename}") + + list(APPEND PROTO_SRCS "${PROTO_GEN_DIR}/${proto_name}.pb.cc") + list(APPEND PROTO_HDRS "${PROTO_GEN_DIR}/${proto_name}.pb.h") + list(APPEND GRPC_SRCS "${PROTO_GEN_DIR}/${proto_name}.grpc.pb.cc") + list(APPEND GRPC_HDRS "${PROTO_GEN_DIR}/${proto_name}.grpc.pb.h") + + # 根据 proto 文件生成 *.pb.cc/*.pb.h 和 *.grpc.pb.cc/*.grpc.pb.h + add_custom_command( + OUTPUT + "${PROTO_GEN_DIR}/${proto_name}.pb.cc" + "${PROTO_GEN_DIR}/${proto_name}.pb.h" + "${PROTO_GEN_DIR}/${proto_name}.grpc.pb.cc" + "${PROTO_GEN_DIR}/${proto_name}.grpc.pb.h" + COMMAND ${_PROTOBUF_PROTOC} + ARGS --grpc_out "${PROTO_GEN_DIR}" + --cpp_out "${PROTO_GEN_DIR}" + -I "${PROTO_SRC_DIR}" + --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" + "${proto_file}" + DEPENDS "${proto_file}") +endforeach() + +# Include generated *.pb.h files +include_directories("${PROTO_GEN_DIR}") + +# jsoncpp (local) +set(JSONCPP_SRCS + "${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/json_reader.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/json_value.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/json_writer.cpp" +) +add_library(jsoncpp STATIC ${JSONCPP_SRCS}) +target_include_directories(jsoncpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# device_grpc_proto (后续需要拆分时,可按模块再建更多 library) +add_library(device_grpc_proto + ${GRPC_SRCS} + ${GRPC_HDRS} + ${PROTO_SRCS} + ${PROTO_HDRS}) +target_link_libraries(device_grpc_proto + ${_REFLECTION} + ${_GRPC_GRPCPP} + ${_PROTOBUF_LIBPROTOBUF}) + +# 可执行文件:如需更多 binary,可按这里的方式新增 add_executable +add_executable(${PROJECT_NAME} "main.cc" "log/easylogging++.cc" "rpc/localstatusclient.h") +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/log + ${CMAKE_CURRENT_SOURCE_DIR}/rpc +) +target_link_libraries(${PROJECT_NAME} + device_grpc_proto + jsoncpp + ${_REFLECTION} + ${_GRPC_GRPCPP} + ${_PROTOBUF_LIBPROTOBUF}) diff --git a/audofeed-device-backend/jsoncpp/json/assertions.h b/audofeed-device-backend/jsoncpp/json/assertions.h new file mode 100644 index 0000000..4876409 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/assertions.h @@ -0,0 +1,41 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED +#define CPPTL_JSON_ASSERTIONS_H_INCLUDED + +#include + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +#if JSON_USE_EXCEPTION +#include +#define JSON_ASSERT(condition) \ + assert(condition); // @todo <= change this into an exception throw +#define JSON_FAIL_MESSAGE(message) throw std::runtime_error(message); +#else // JSON_USE_EXCEPTION +#define JSON_ASSERT(condition) assert(condition); + +// The call to assert() will show the failure message in debug builds. In +// release bugs we write to invalid memory in order to crash hard, so that a +// debugger or crash reporter gets the chance to take over. We still call exit() +// afterward in order to tell the compiler that this macro doesn't return. +#define JSON_FAIL_MESSAGE(message) \ + { \ + assert(false &&message); \ + strcpy(reinterpret_cast(666), message); \ + exit(123); \ + } + +#endif + +#define JSON_ASSERT_MESSAGE(condition, message) \ + if (!(condition)) { \ + JSON_FAIL_MESSAGE(message) \ + } + +#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/autolink.h b/audofeed-device-backend/jsoncpp/json/autolink.h new file mode 100644 index 0000000..c9881db --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/autolink.h @@ -0,0 +1,25 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_AUTOLINK_H_INCLUDED +#define JSON_AUTOLINK_H_INCLUDED + +#include "config.h" + +#ifdef JSON_IN_CPPTL +#include +#endif + +#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ + !defined(JSON_IN_CPPTL) +#define CPPTL_AUTOLINK_NAME "json" +#undef CPPTL_AUTOLINK_DLL +#ifdef JSON_DLL +#define CPPTL_AUTOLINK_DLL +#endif +#include "autolink.h" +#endif + +#endif // JSON_AUTOLINK_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/config.h b/audofeed-device-backend/jsoncpp/json/config.h new file mode 100644 index 0000000..54b3d48 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/config.h @@ -0,0 +1,112 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +#define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of +/// std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 +/// If defined, indicates that Json specific container should be used +/// (hash table & simple deque container with customizable allocator). +/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332 +//# define JSON_VALUE_USE_INTERNAL_MAP 1 +/// Force usage of standard new/malloc based allocator instead of memory pool +/// based allocator. +/// The memory pools allocator used optimization (initializing Value and +/// ValueInternalLink +/// as if it was a POD) that may cause some validation tool to report errors. +/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. +//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +#ifndef JSON_USE_EXCEPTION +#define JSON_USE_EXCEPTION 1 +#endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + +#ifdef JSON_IN_CPPTL +#include +#ifndef JSON_USE_CPPTL +#define JSON_USE_CPPTL 1 +#endif +#endif + +#ifdef JSON_IN_CPPTL +#define JSON_API CPPTL_API +#elif defined(JSON_DLL_BUILD) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllexport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#elif defined(JSON_DLL) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllimport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#endif // ifdef JSON_IN_CPPTL +#if !defined(JSON_API) +#define JSON_API +#endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for +// integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 +// Microsoft Visual Studio 6 only support conversion from __int64 to double +// (no conversion from unsigned __int64). +#define JSON_USE_INT64_DOUBLE_CONVERSION 1 +// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' +// characters in the debug information) +// All projects I've ever seen with VS6 were using this globally (not bothering +// with pragma push/pop). +#pragma warning(disable : 4786) +#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 + +#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 +/// Indicates that the following function is deprecated. +#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +#endif + +#if !defined(JSONCPP_DEPRECATED) +#define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { +typedef int Int; +typedef unsigned int UInt; +#if defined(JSON_NO_INT64) +typedef int LargestInt; +typedef unsigned int LargestUInt; +#undef JSON_HAS_INT64 +#else // if defined(JSON_NO_INT64) +// For Microsoft Visual use specific types as long long is not supported +#if defined(_MSC_VER) // Microsoft Visual Studio +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#else // if defined(_MSC_VER) // Other platforms, use long long +typedef long long int Int64; +typedef unsigned long long int UInt64; +#endif // if defined(_MSC_VER) +typedef Int64 LargestInt; +typedef UInt64 LargestUInt; +#define JSON_HAS_INT64 +#endif // if defined(JSON_NO_INT64) +} // end namespace Json + +#endif // JSON_CONFIG_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/features.h b/audofeed-device-backend/jsoncpp/json/features.h new file mode 100644 index 0000000..bad7601 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/features.h @@ -0,0 +1,57 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED +#define CPPTL_JSON_FEATURES_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +/** \brief Configuration passed to reader and writer. + * This configuration object can be used to force the Reader or Writer + * to behave in a standard conforming way. + */ +class JSON_API Features { +public: + /** \brief A configuration that allows all features and assumes all strings + * are UTF-8. + * - C & C++ comments are allowed + * - Root object can be any JSON value + * - Assumes Value strings are encoded in UTF-8 + */ + static Features all(); + + /** \brief A configuration that is strictly compatible with the JSON + * specification. + * - Comments are forbidden. + * - Root object must be either an array or an object value. + * - Assumes Value strings are encoded in UTF-8 + */ + static Features strictMode(); + + /** \brief Initialize the configuration like JsonConfig::allFeatures; + */ + Features(); + + /// \c true if comments are allowed. Default: \c true. + bool allowComments_; + + /// \c true if root must be either an array or an object value. Default: \c + /// false. + bool strictRoot_; + + /// \c true if dropped null placeholders are allowed. Default: \c false. + bool allowDroppedNullPlaceholders_; + + /// \c true if numeric object key are allowed. Default: \c false. + bool allowNumericKeys_; +}; + +} // namespace Json + +#endif // CPPTL_JSON_FEATURES_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/forwards.h b/audofeed-device-backend/jsoncpp/json/forwards.h new file mode 100644 index 0000000..d91daed --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/forwards.h @@ -0,0 +1,43 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +#define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// writer.h +class FastWriter; +class StyledWriter; + +// reader.h +class Reader; + +// features.h +class Features; + +// value.h +typedef unsigned int ArrayIndex; +class StaticString; +class Path; +class PathArgument; +class Value; +class ValueIteratorBase; +class ValueIterator; +class ValueConstIterator; +#ifdef JSON_VALUE_USE_INTERNAL_MAP +class ValueMapAllocator; +class ValueInternalLink; +class ValueInternalArray; +class ValueInternalMap; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + +} // namespace Json + +#endif // JSON_FORWARDS_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/json.h b/audofeed-device-backend/jsoncpp/json/json.h new file mode 100644 index 0000000..2ec87d6 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/json.h @@ -0,0 +1,15 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_JSON_H_INCLUDED +#define JSON_JSON_H_INCLUDED + +#include "autolink.h" +#include "value.h" +#include "reader.h" +#include "writer.h" +#include "features.h" + +#endif // JSON_JSON_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/reader.h b/audofeed-device-backend/jsoncpp/json/reader.h new file mode 100644 index 0000000..8cbe97c --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/reader.h @@ -0,0 +1,253 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_READER_H_INCLUDED +#define CPPTL_JSON_READER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "features.h" +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +/** \brief Unserialize a JSON document into a + *Value. + * + */ +class JSON_API Reader { +public: + typedef char Char; + typedef const Char *Location; + + /** \brief An error tagged with where in the JSON text it was encountered. + * + * The offsets give the [start, limit) range of bytes within the text. Note + * that this is bytes, not codepoints. + * + */ + struct StructuredError { + size_t offset_start; + size_t offset_limit; + std::string message; + }; + + /** \brief Constructs a Reader allowing all features + * for parsing. + */ + Reader(); + + /** \brief Constructs a Reader allowing the specified feature set + * for parsing. + */ + Reader(const Features &features); + + /** \brief Read a Value from a JSON + * document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + * back during + * serialization, \c false to discard comments. + * This parameter is ignored if + * Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + * error occurred. + */ + bool + parse(const std::string &document, Value &root, bool collectComments = true); + + /** \brief Read a Value from a JSON + document. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the + document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the + document to read. + \ Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + back during + * serialization, \c false to discard comments. + * This parameter is ignored if + Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + error occurred. + */ + bool parse(const char *beginDoc, + const char *endDoc, + Value &root, + bool collectComments = true); + + /// \brief Parse from input stream. + /// \see Json::operator>>(std::istream&, Json::Value&). + bool parse(std::istream &is, Value &root, bool collectComments = true); + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + * \deprecated Use getFormattedErrorMessages() instead (typo fix). + */ + JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead") + std::string getFormatedErrorMessages() const; + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + */ + std::string getFormattedErrorMessages() const; + + /** \brief Returns a vector of structured erros encounted while parsing. + * \return A (possibly empty) vector of StructuredError objects. Currently + * only one error can be returned, but the caller should tolerate + * multiple + * errors. This can occur if the parser recovers from a non-fatal + * parse error and then encounters additional errors. + */ + std::vector getStructuredErrors() const; + +private: + enum TokenType { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool expectToken(TokenType type, Token &token, const char *message); + bool readToken(Token &token); + void skipSpaces(); + bool match(Location pattern, int patternLength); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + void readNumber(); + bool readValue(); + bool readObject(Token &token); + bool readArray(Token &token); + bool decodeNumber(Token &token); + bool decodeNumber(Token &token, Value &decoded); + bool decodeString(Token &token); + bool decodeString(Token &token, std::string &decoded); + bool decodeDouble(Token &token); + bool decodeDouble(Token &token, Value &decoded); + bool decodeUnicodeCodePoint(Token &token, + Location ¤t, + Location end, + unsigned int &unicode); + bool decodeUnicodeEscapeSequence(Token &token, + Location ¤t, + Location end, + unsigned int &unicode); + bool addError(const std::string &message, Token &token, Location extra = 0); + bool recoverFromError(TokenType skipUntilToken); + bool addErrorAndRecover(const std::string &message, + Token &token, + TokenType skipUntilToken); + void skipUntilSpace(); + Value ¤tValue(); + Char getNextChar(); + void + getLocationLineAndColumn(Location location, int &line, int &column) const; + std::string getLocationLineAndColumn(Location location) const; + void addComment(Location begin, Location end, CommentPlacement placement); + void skipCommentTokens(Token &token); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value *lastValue_; + std::string commentsBefore_; + Features features_; + bool collectComments_; +}; + +/** \brief Read from 'sin' into 'root'. + + Always keep comments from the input JSON. + + This can be used to read a file into a particular sub-object. + For example: + \code + Json::Value root; + cin >> root["dir"]["file"]; + cout << root; + \endcode + Result: + \verbatim + { + "dir": { + "file": { + // The input stream JSON would be nested here. + } + } + } + \endverbatim + \throw std::exception on parse error. + \see Json::operator<<() +*/ +JSON_API std::istream &operator>>(std::istream &, Value &); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_READER_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/value.h b/audofeed-device-backend/jsoncpp/json/value.h new file mode 100644 index 0000000..794e15f --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/value.h @@ -0,0 +1,1082 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_H_INCLUDED +#define CPPTL_JSON_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include + +#ifndef JSON_USE_CPPTL_SMALLMAP +#include +#else +#include +#endif +#ifdef JSON_USE_CPPTL +#include +#endif + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +/** \brief JSON (JavaScript Object Notation). + */ +namespace Json { + +/** \brief Type of the value held by a Value object. + */ +enum ValueType { + nullValue = 0, ///< 'null' value + intValue, ///< signed integer value + uintValue, ///< unsigned integer value + realValue, ///< double value + stringValue, ///< UTF-8 string value + booleanValue, ///< bool value + arrayValue, ///< array value (ordered list) + objectValue ///< object value (collection of name/value pairs). +}; + +enum CommentPlacement { + commentBefore = 0, ///< a comment placed on the line before a value + commentAfterOnSameLine, ///< a comment just after a value on the same line + commentAfter, ///< a comment on the line after a value (only make sense for + /// root value) + numberOfCommentPlacement +}; + +//# ifdef JSON_USE_CPPTL +// typedef CppTL::AnyEnumerator EnumMemberNames; +// typedef CppTL::AnyEnumerator EnumValues; +//# endif + +/** \brief Lightweight wrapper to tag static string. + * + * Value constructor and objectValue member assignement takes advantage of the + * StaticString and avoid the cost of string duplication when storing the + * string or the member name. + * + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ +class JSON_API StaticString { +public: + explicit StaticString(const char *czstring) : str_(czstring) {} + + operator const char *() const { return str_; } + + const char *c_str() const { return str_; } + +private: + const char *str_; +}; + +/** \brief Represents a JSON value. + * + * This class is a discriminated union wrapper that can represents a: + * - signed integer [range: Value::minInt - Value::maxInt] + * - unsigned integer (range: 0 - Value::maxUInt) + * - double + * - UTF-8 string + * - boolean + * - 'null' + * - an ordered list of Value + * - collection of name/value pairs (javascript object) + * + * The type of the held value is represented by a #ValueType and + * can be obtained using type(). + * + * values of an #objectValue or #arrayValue can be accessed using operator[]() + *methods. + * Non const methods will automatically create the a #nullValue element + * if it does not exist. + * The sequence of an #arrayValue will be automatically resize and initialized + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. + * + * The get() methods can be used to obtanis default value in the case the + *required element + * does not exist. + * + * It is possible to iterate over the list of a #objectValue values using + * the getMemberNames() method. + */ +class JSON_API Value { + friend class ValueIteratorBase; +#ifdef JSON_VALUE_USE_INTERNAL_MAP + friend class ValueInternalLink; + friend class ValueInternalMap; +#endif +public: + typedef std::vector Members; + typedef ValueIterator iterator; + typedef ValueConstIterator const_iterator; + typedef Json::UInt UInt; + typedef Json::Int Int; +#if defined(JSON_HAS_INT64) + typedef Json::UInt64 UInt64; + typedef Json::Int64 Int64; +#endif // defined(JSON_HAS_INT64) + typedef Json::LargestInt LargestInt; + typedef Json::LargestUInt LargestUInt; + typedef Json::ArrayIndex ArrayIndex; + + static const Value& null; + /// Minimum signed integer value that can be stored in a Json::Value. + static const LargestInt minLargestInt; + /// Maximum signed integer value that can be stored in a Json::Value. + static const LargestInt maxLargestInt; + /// Maximum unsigned integer value that can be stored in a Json::Value. + static const LargestUInt maxLargestUInt; + + /// Minimum signed int value that can be stored in a Json::Value. + static const Int minInt; + /// Maximum signed int value that can be stored in a Json::Value. + static const Int maxInt; + /// Maximum unsigned int value that can be stored in a Json::Value. + static const UInt maxUInt; + +#if defined(JSON_HAS_INT64) + /// Minimum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 minInt64; + /// Maximum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 maxInt64; + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. + static const UInt64 maxUInt64; +#endif // defined(JSON_HAS_INT64) + +private: +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION +#ifndef JSON_VALUE_USE_INTERNAL_MAP + class CZString { + public: + enum DuplicationPolicy { + noDuplication = 0, + duplicate, + duplicateOnCopy + }; + CZString(ArrayIndex index); + CZString(const char *cstr, DuplicationPolicy allocate); + CZString(const CZString &other); + ~CZString(); + CZString &operator=(const CZString &other); + bool operator<(const CZString &other) const; + bool operator==(const CZString &other) const; + ArrayIndex index() const; + const char *c_str() const; + bool isStaticString() const; + + private: + void swap(CZString &other); + const char *cstr_; + ArrayIndex index_; + }; + +public: +#ifndef JSON_USE_CPPTL_SMALLMAP + typedef std::map ObjectValues; +#else + typedef CppTL::SmallMap ObjectValues; +#endif // ifndef JSON_USE_CPPTL_SMALLMAP +#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +public: + /** \brief Create a default Value of the given type. + + This is a very useful constructor. + To create an empty array, pass arrayValue. + To create an empty object, pass objectValue. + Another Value can then be set to this one by assignment. +This is useful since clear() and resize() will not alter types. + + Examples: +\code +Json::Value null_value; // null +Json::Value arr_value(Json::arrayValue); // [] +Json::Value obj_value(Json::objectValue); // {} +\endcode + */ + Value(ValueType type = nullValue); + Value(Int value); + Value(UInt value); +#if defined(JSON_HAS_INT64) + Value(Int64 value); + Value(UInt64 value); +#endif // if defined(JSON_HAS_INT64) + Value(double value); + Value(const char *value); + Value(const char *beginValue, const char *endValue); + /** \brief Constructs a value from a static string. + + * Like other value string constructor but do not duplicate the string for + * internal storage. The given string must remain alive after the call to this + * constructor. + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * \endcode + */ + Value(const StaticString &value); + Value(const std::string &value); +#ifdef JSON_USE_CPPTL + Value(const CppTL::ConstString &value); +#endif + Value(bool value); + Value(const Value &other); + ~Value(); + + Value &operator=(const Value &other); + /// Swap values. + /// \note Currently, comments are intentionally not swapped, for + /// both logic and efficiency. + void swap(Value &other); + + ValueType type() const; + + bool operator<(const Value &other) const; + bool operator<=(const Value &other) const; + bool operator>=(const Value &other) const; + bool operator>(const Value &other) const; + + bool operator==(const Value &other) const; + bool operator!=(const Value &other) const; + + int compare(const Value &other) const; + + const char *asCString() const; + std::string asString() const; +#ifdef JSON_USE_CPPTL + CppTL::ConstString asConstString() const; +#endif + Int asInt() const; + UInt asUInt() const; +#if defined(JSON_HAS_INT64) + Int64 asInt64() const; + UInt64 asUInt64() const; +#endif // if defined(JSON_HAS_INT64) + LargestInt asLargestInt() const; + LargestUInt asLargestUInt() const; + float asFloat() const; + double asDouble() const; + bool asBool() const; + + bool isNull() const; + bool isBool() const; + bool isInt() const; + bool isInt64() const; + bool isUInt() const; + bool isUInt64() const; + bool isIntegral() const; + bool isDouble() const; + bool isNumeric() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + + bool isConvertibleTo(ValueType other) const; + + /// Number of values in array or object + ArrayIndex size() const; + + /// \brief Return true if empty array, empty object, or null; + /// otherwise, false. + bool empty() const; + + /// Return isNull() + bool operator!() const; + + /// Remove all object members and array elements. + /// \pre type() is arrayValue, objectValue, or nullValue + /// \post type() is unchanged + void clear(); + + /// Resize the array to size elements. + /// New elements are initialized to null. + /// May only be called on nullValue or arrayValue. + /// \pre type() is arrayValue or nullValue + /// \post type() is arrayValue + void resize(ArrayIndex size); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[](ArrayIndex index); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[](int index); + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[](ArrayIndex index) const; + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[](int index) const; + + /// If the array contains at least index+1 elements, returns the element + /// value, + /// otherwise returns defaultValue. + Value get(ArrayIndex index, const Value &defaultValue) const; + /// Return true if index < size(). + bool isValidIndex(ArrayIndex index) const; + /// \brief Append value to array at the end. + /// + /// Equivalent to jsonvalue[jsonvalue.size()] = value; + Value &append(const Value &value); + + /// Access an object value by name, create a null member if it does not exist. + Value &operator[](const char *key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value &operator[](const char *key) const; + /// Access an object value by name, create a null member if it does not exist. + Value &operator[](const std::string &key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value &operator[](const std::string &key) const; + /** \brief Access an object value by name, create a null member if it does not + exist. + + * If the object as no entry for that name, then the member name used to store + * the new entry is not duplicated. + * Example of use: + * \code + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + Value &operator[](const StaticString &key); +#ifdef JSON_USE_CPPTL + /// Access an object value by name, create a null member if it does not exist. + Value &operator[](const CppTL::ConstString &key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value &operator[](const CppTL::ConstString &key) const; +#endif + /// Return the member named key if it exist, defaultValue otherwise. + Value get(const char *key, const Value &defaultValue) const; + /// Return the member named key if it exist, defaultValue otherwise. + Value get(const std::string &key, const Value &defaultValue) const; +#ifdef JSON_USE_CPPTL + /// Return the member named key if it exist, defaultValue otherwise. + Value get(const CppTL::ConstString &key, const Value &defaultValue) const; +#endif + /// \brief Remove and return the named member. + /// + /// Do nothing if it did not exist. + /// \return the removed Value, or null. + /// \pre type() is objectValue or nullValue + /// \post type() is unchanged + Value removeMember(const char *key); + /// Same as removeMember(const char*) + Value removeMember(const std::string &key); + + /// Return true if the object has a member named key. + bool isMember(const char *key) const; + /// Return true if the object has a member named key. + bool isMember(const std::string &key) const; +#ifdef JSON_USE_CPPTL + /// Return true if the object has a member named key. + bool isMember(const CppTL::ConstString &key) const; +#endif + + /// \brief Return a list of the member names. + /// + /// If null, return an empty list. + /// \pre type() is objectValue or nullValue + /// \post if type() was nullValue, it remains nullValue + Members getMemberNames() const; + + //# ifdef JSON_USE_CPPTL + // EnumMemberNames enumMemberNames() const; + // EnumValues enumValues() const; + //# endif + + /// Comments must be //... or /* ... */ + void setComment(const char *comment, CommentPlacement placement); + /// Comments must be //... or /* ... */ + void setComment(const std::string &comment, CommentPlacement placement); + bool hasComment(CommentPlacement placement) const; + /// Include delimiters and embedded newlines. + std::string getComment(CommentPlacement placement) const; + + std::string toStyledString() const; + + const_iterator begin() const; + const_iterator end() const; + + iterator begin(); + iterator end(); + + // Accessors for the [start, limit) range of bytes within the JSON text from + // which this value was parsed, if any. + void setOffsetStart(size_t start); + void setOffsetLimit(size_t limit); + size_t getOffsetStart() const; + size_t getOffsetLimit() const; + +private: + Value &resolveReference(const char *key, bool isStatic); + +#ifdef JSON_VALUE_USE_INTERNAL_MAP + inline bool isItemAvailable() const { return itemIsUsed_ == 0; } + + inline void setItemUsed(bool isUsed = true) { itemIsUsed_ = isUsed ? 1 : 0; } + + inline bool isMemberNameStatic() const { return memberNameIsStatic_ == 0; } + + inline void setMemberNameIsStatic(bool isStatic) { + memberNameIsStatic_ = isStatic ? 1 : 0; + } +#endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP + +private: + struct CommentInfo { + CommentInfo(); + ~CommentInfo(); + + void setComment(const char *text); + + char *comment_; + }; + + // struct MemberNamesTransform + //{ + // typedef const char *result_type; + // const char *operator()( const CZString &name ) const + // { + // return name.c_str(); + // } + //}; + + union ValueHolder { + LargestInt int_; + LargestUInt uint_; + double real_; + bool bool_; + char *string_; +#ifdef JSON_VALUE_USE_INTERNAL_MAP + ValueInternalArray *array_; + ValueInternalMap *map_; +#else + ObjectValues *map_; +#endif + } value_; + ValueType type_ : 8; + int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. +#ifdef JSON_VALUE_USE_INTERNAL_MAP + unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. + int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. +#endif + CommentInfo *comments_; + + // [start, limit) byte offsets in the source JSON text from which this Value + // was extracted. + size_t start_; + size_t limit_; +}; + +/** \brief Experimental and untested: represents an element of the "path" to + * access a node. + */ +class JSON_API PathArgument { +public: + friend class Path; + + PathArgument(); + PathArgument(ArrayIndex index); + PathArgument(const char *key); + PathArgument(const std::string &key); + +private: + enum Kind { + kindNone = 0, + kindIndex, + kindKey + }; + std::string key_; + ArrayIndex index_; + Kind kind_; +}; + +/** \brief Experimental and untested: represents a "path" to access a node. + * + * Syntax: + * - "." => root node + * - ".[n]" => elements at index 'n' of root node (an array value) + * - ".name" => member named 'name' of root node (an object value) + * - ".name1.name2.name3" + * - ".[0][1][2].name1[3]" + * - ".%" => member name is provided as parameter + * - ".[%]" => index is provied as parameter + */ +class JSON_API Path { +public: + Path(const std::string &path, + const PathArgument &a1 = PathArgument(), + const PathArgument &a2 = PathArgument(), + const PathArgument &a3 = PathArgument(), + const PathArgument &a4 = PathArgument(), + const PathArgument &a5 = PathArgument()); + + const Value &resolve(const Value &root) const; + Value resolve(const Value &root, const Value &defaultValue) const; + /// Creates the "path" to access the specified node and returns a reference on + /// the node. + Value &make(Value &root) const; + +private: + typedef std::vector InArgs; + typedef std::vector Args; + + void makePath(const std::string &path, const InArgs &in); + void addPathInArg(const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind); + void invalidPath(const std::string &path, int location); + + Args args_; +}; + +#ifdef JSON_VALUE_USE_INTERNAL_MAP +/** \brief Allocator to customize Value internal map. + * Below is an example of a simple implementation (default implementation + actually + * use memory pool for speed). + * \code + class DefaultValueMapAllocator : public ValueMapAllocator + { + public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + return new ValueInternalMap(); + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + return new ValueInternalMap( other ); + } + + virtual void destructMap( ValueInternalMap *map ) + { + delete map; + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + return new ValueInternalLink(); + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + delete link; + } + }; + * \endcode + */ +class JSON_API ValueMapAllocator { +public: + virtual ~ValueMapAllocator(); + virtual ValueInternalMap *newMap() = 0; + virtual ValueInternalMap *newMapCopy(const ValueInternalMap &other) = 0; + virtual void destructMap(ValueInternalMap *map) = 0; + virtual ValueInternalLink *allocateMapBuckets(unsigned int size) = 0; + virtual void releaseMapBuckets(ValueInternalLink *links) = 0; + virtual ValueInternalLink *allocateMapLink() = 0; + virtual void releaseMapLink(ValueInternalLink *link) = 0; +}; + +/** \brief ValueInternalMap hash-map bucket chain link (for internal use only). + * \internal previous_ & next_ allows for bidirectional traversal. + */ +class JSON_API ValueInternalLink { +public: + enum { + itemPerLink = 6 + }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture. + enum InternalFlags { + flagAvailable = 0, + flagUsed = 1 + }; + + ValueInternalLink(); + + ~ValueInternalLink(); + + Value items_[itemPerLink]; + char *keys_[itemPerLink]; + ValueInternalLink *previous_; + ValueInternalLink *next_; +}; + +/** \brief A linked page based hash-table implementation used internally by + *Value. + * \internal ValueInternalMap is a tradional bucket based hash-table, with a + *linked + * list in each bucket to handle collision. There is an addional twist in that + * each node of the collision linked list is a page containing a fixed amount of + * value. This provides a better compromise between memory usage and speed. + * + * Each bucket is made up of a chained list of ValueInternalLink. The last + * link of a given bucket can be found in the 'previous_' field of the following + *bucket. + * The last link of the last bucket is stored in tailLink_ as it has no + *following bucket. + * Only the last link of a bucket may contains 'available' item. The last link + *always + * contains at least one element unless is it the bucket one very first link. + */ +class JSON_API ValueInternalMap { + friend class ValueIteratorBase; + friend class Value; + +public: + typedef unsigned int HashKey; + typedef unsigned int BucketIndex; + +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState { + IteratorState() : map_(0), link_(0), itemIndex_(0), bucketIndex_(0) {} + ValueInternalMap *map_; + ValueInternalLink *link_; + BucketIndex itemIndex_; + BucketIndex bucketIndex_; + }; +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalMap(); + ValueInternalMap(const ValueInternalMap &other); + ValueInternalMap &operator=(const ValueInternalMap &other); + ~ValueInternalMap(); + + void swap(ValueInternalMap &other); + + BucketIndex size() const; + + void clear(); + + bool reserveDelta(BucketIndex growth); + + bool reserve(BucketIndex newItemCount); + + const Value *find(const char *key) const; + + Value *find(const char *key); + + Value &resolveReference(const char *key, bool isStatic); + + void remove(const char *key); + + void doActualRemove(ValueInternalLink *link, + BucketIndex index, + BucketIndex bucketIndex); + + ValueInternalLink *&getLastLinkInBucket(BucketIndex bucketIndex); + + Value &setNewItem(const char *key, + bool isStatic, + ValueInternalLink *link, + BucketIndex index); + + Value &unsafeAdd(const char *key, bool isStatic, HashKey hashedKey); + + HashKey hash(const char *key) const; + + int compare(const ValueInternalMap &other) const; + +private: + void makeBeginIterator(IteratorState &it) const; + void makeEndIterator(IteratorState &it) const; + static bool equals(const IteratorState &x, const IteratorState &other); + static void increment(IteratorState &iterator); + static void incrementBucket(IteratorState &iterator); + static void decrement(IteratorState &iterator); + static const char *key(const IteratorState &iterator); + static const char *key(const IteratorState &iterator, bool &isStatic); + static Value &value(const IteratorState &iterator); + static int distance(const IteratorState &x, const IteratorState &y); + +private: + ValueInternalLink *buckets_; + ValueInternalLink *tailLink_; + BucketIndex bucketsSize_; + BucketIndex itemCount_; +}; + +/** \brief A simplified deque implementation used internally by Value. +* \internal +* It is based on a list of fixed "page", each page contains a fixed number of +*items. +* Instead of using a linked-list, a array of pointer is used for fast item +*look-up. +* Look-up for an element is as follow: +* - compute page index: pageIndex = itemIndex / itemsPerPage +* - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage] +* +* Insertion is amortized constant time (only the array containing the index of +*pointers +* need to be reallocated when items are appended). +*/ +class JSON_API ValueInternalArray { + friend class Value; + friend class ValueIteratorBase; + +public: + enum { + itemsPerPage = 8 + }; // should be a power of 2 for fast divide and modulo. + typedef Value::ArrayIndex ArrayIndex; + typedef unsigned int PageIndex; + +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + struct IteratorState // Must be a POD + { + IteratorState() : array_(0), currentPageIndex_(0), currentItemIndex_(0) {} + ValueInternalArray *array_; + Value **currentPageIndex_; + unsigned int currentItemIndex_; + }; +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + + ValueInternalArray(); + ValueInternalArray(const ValueInternalArray &other); + ValueInternalArray &operator=(const ValueInternalArray &other); + ~ValueInternalArray(); + void swap(ValueInternalArray &other); + + void clear(); + void resize(ArrayIndex newSize); + + Value &resolveReference(ArrayIndex index); + + Value *find(ArrayIndex index) const; + + ArrayIndex size() const; + + int compare(const ValueInternalArray &other) const; + +private: + static bool equals(const IteratorState &x, const IteratorState &other); + static void increment(IteratorState &iterator); + static void decrement(IteratorState &iterator); + static Value &dereference(const IteratorState &iterator); + static Value &unsafeDereference(const IteratorState &iterator); + static int distance(const IteratorState &x, const IteratorState &y); + static ArrayIndex indexOf(const IteratorState &iterator); + void makeBeginIterator(IteratorState &it) const; + void makeEndIterator(IteratorState &it) const; + void makeIterator(IteratorState &it, ArrayIndex index) const; + + void makeIndexValid(ArrayIndex index); + + Value **pages_; + ArrayIndex size_; + PageIndex pageCount_; +}; + +/** \brief Experimental: do not use. Allocator to customize Value internal +array. + * Below is an example of a simple implementation (actual implementation use + * memory pool). + \code +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator +virtual ~DefaultValueArrayAllocator() +{ +} + +virtual ValueInternalArray *newArray() +{ + return new ValueInternalArray(); +} + +virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) +{ + return new ValueInternalArray( other ); +} + +virtual void destruct( ValueInternalArray *array ) +{ + delete array; +} + +virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex +&indexCount, + ValueInternalArray::PageIndex +minNewIndexCount ) +{ + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + if ( !newIndexes ) + throw std::bad_alloc(); + indexCount = newIndexCount; + indexes = static_cast( newIndexes ); +} +virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) +{ + if ( indexes ) + free( indexes ); +} + +virtual Value *allocateArrayPage() +{ + return static_cast( malloc( sizeof(Value) * +ValueInternalArray::itemsPerPage ) ); +} + +virtual void releaseArrayPage( Value *value ) +{ + if ( value ) + free( value ); +} +}; + \endcode + */ +class JSON_API ValueArrayAllocator { +public: + virtual ~ValueArrayAllocator(); + virtual ValueInternalArray *newArray() = 0; + virtual ValueInternalArray *newArrayCopy(const ValueInternalArray &other) = 0; + virtual void destructArray(ValueInternalArray *array) = 0; + /** \brief Reallocate array page index. + * Reallocates an array of pointer on each page. + * \param indexes [input] pointer on the current index. May be \c NULL. + * [output] pointer on the new index of at least + * \a minNewIndexCount pages. + * \param indexCount [input] current number of pages in the index. + * [output] number of page the reallocated index can handle. + * \b MUST be >= \a minNewIndexCount. + * \param minNewIndexCount Minimum number of page the new index must be able + * to + * handle. + */ + virtual void + reallocateArrayPageIndex(Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount) = 0; + virtual void + releaseArrayPageIndex(Value **indexes, + ValueInternalArray::PageIndex indexCount) = 0; + virtual Value *allocateArrayPage() = 0; + virtual void releaseArrayPage(Value *value) = 0; +}; +#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP + +/** \brief base class for Value iterators. + * + */ +class JSON_API ValueIteratorBase { +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef unsigned int size_t; + typedef int difference_type; + typedef ValueIteratorBase SelfType; + + ValueIteratorBase(); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIteratorBase(const Value::ObjectValues::iterator ¤t); +#else + ValueIteratorBase(const ValueInternalArray::IteratorState &state); + ValueIteratorBase(const ValueInternalMap::IteratorState &state); +#endif + + bool operator==(const SelfType &other) const { return isEqual(other); } + + bool operator!=(const SelfType &other) const { return !isEqual(other); } + + difference_type operator-(const SelfType &other) const { + return computeDistance(other); + } + + /// Return either the index or the member name of the referenced value as a + /// Value. + Value key() const; + + /// Return the index of the referenced Value. -1 if it is not an arrayValue. + UInt index() const; + + /// Return the member name of the referenced Value. "" if it is not an + /// objectValue. + const char *memberName() const; + +protected: + Value &deref() const; + + void increment(); + + void decrement(); + + difference_type computeDistance(const SelfType &other) const; + + bool isEqual(const SelfType &other) const; + + void copy(const SelfType &other); + +private: +#ifndef JSON_VALUE_USE_INTERNAL_MAP + Value::ObjectValues::iterator current_; + // Indicates that iterator is for a null value. + bool isNull_; +#else + union { + ValueInternalArray::IteratorState array_; + ValueInternalMap::IteratorState map_; + } iterator_; + bool isArray_; +#endif +}; + +/** \brief const iterator for object and array value. + * + */ +class JSON_API ValueConstIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef const Value value_type; + typedef unsigned int size_t; + typedef int difference_type; + typedef const Value &reference; + typedef const Value *pointer; + typedef ValueConstIterator SelfType; + + ValueConstIterator(); + +private: +/*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueConstIterator(const Value::ObjectValues::iterator ¤t); +#else + ValueConstIterator(const ValueInternalArray::IteratorState &state); + ValueConstIterator(const ValueInternalMap::IteratorState &state); +#endif +public: + SelfType &operator=(const ValueIteratorBase &other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType &operator--() { + decrement(); + return *this; + } + + SelfType &operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } +}; + +/** \brief Iterator for object and array value. + */ +class JSON_API ValueIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef Value value_type; + typedef unsigned int size_t; + typedef int difference_type; + typedef Value &reference; + typedef Value *pointer; + typedef ValueIterator SelfType; + + ValueIterator(); + ValueIterator(const ValueConstIterator &other); + ValueIterator(const ValueIterator &other); + +private: +/*! \internal Use by Value to create an iterator. + */ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + explicit ValueIterator(const Value::ObjectValues::iterator ¤t); +#else + ValueIterator(const ValueInternalArray::IteratorState &state); + ValueIterator(const ValueInternalMap::IteratorState &state); +#endif +public: + SelfType &operator=(const SelfType &other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType &operator--() { + decrement(); + return *this; + } + + SelfType &operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } +}; + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json/writer.h b/audofeed-device-backend/jsoncpp/json/writer.h new file mode 100644 index 0000000..047286c --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json/writer.h @@ -0,0 +1,210 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_WRITER_H_INCLUDED +#define JSON_WRITER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +class Value; + +/** \brief Abstract class for writers. + */ +class JSON_API Writer { +public: + virtual ~Writer(); + + virtual std::string write(const Value &root) = 0; +}; + +/** \brief Outputs a Value in JSON format + *without formatting (not human friendly). + * + * The JSON document is written in a single line. It is not intended for 'human' + *consumption, + * but may be usefull to support feature such as RPC where bandwith is limited. + * \sa Reader, Value + */ +class JSON_API FastWriter : public Writer { +public: + FastWriter(); + virtual ~FastWriter() {} + + void enableYAMLCompatibility(); + + /** \brief Drop the "null" string from the writer's output for nullValues. + * Strictly speaking, this is not valid JSON. But when the output is being + * fed to a browser's Javascript, it makes for smaller output and the + * browser can handle the output just fine. + */ + void dropNullPlaceholders(); + +public: // overridden from Writer + virtual std::string write(const Value &root); + +private: + void writeValue(const Value &value); + + std::string document_; + bool yamlCompatiblityEnabled_; + bool dropNullPlaceholders_; +}; + +/** \brief Writes a Value in JSON format in a + *human friendly way. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + *line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + *types, + * and all the values fit on one lines, then print the array on a single + *line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + *#CommentPlacement. + * + * \sa Reader, Value, Value::setComment() + */ +class JSON_API StyledWriter : public Writer { +public: + StyledWriter(); + virtual ~StyledWriter() {} + +public: // overridden from Writer + /** \brief Serialize a Value in JSON format. + * \param root Value to serialize. + * \return String containing the JSON document that represents the root value. + */ + virtual std::string write(const Value &root); + +private: + void writeValue(const Value &value); + void writeArrayValue(const Value &value); + bool isMultineArray(const Value &value); + void pushValue(const std::string &value); + void writeIndent(); + void writeWithIndent(const std::string &value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value &root); + void writeCommentAfterValueOnSameLine(const Value &root); + bool hasCommentForValue(const Value &value); + static std::string normalizeEOL(const std::string &text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string document_; + std::string indentString_; + int rightMargin_; + int indentSize_; + bool addChildValues_; +}; + +/** \brief Writes a Value in JSON format in a + human friendly way, + to a stream rather than to a string. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + types, + * and all the values fit on one lines, then print the array on a single + line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + #CommentPlacement. + * + * \param indentation Each level will be indented by this amount extra. + * \sa Reader, Value, Value::setComment() + */ +class JSON_API StyledStreamWriter { +public: + StyledStreamWriter(std::string indentation = "\t"); + ~StyledStreamWriter() {} + +public: + /** \brief Serialize a Value in JSON format. + * \param out Stream to write to. (Can be ostringstream, e.g.) + * \param root Value to serialize. + * \note There is no point in deriving from Writer, since write() should not + * return a value. + */ + void write(std::ostream &out, const Value &root); + +private: + void writeValue(const Value &value); + void writeArrayValue(const Value &value); + bool isMultineArray(const Value &value); + void pushValue(const std::string &value); + void writeIndent(); + void writeWithIndent(const std::string &value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value &root); + void writeCommentAfterValueOnSameLine(const Value &root); + bool hasCommentForValue(const Value &value); + static std::string normalizeEOL(const std::string &text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::ostream *document_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + bool addChildValues_; +}; + +#if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(Int value); +std::string JSON_API valueToString(UInt value); +#endif // if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(LargestInt value); +std::string JSON_API valueToString(LargestUInt value); +std::string JSON_API valueToString(double value); +std::string JSON_API valueToString(bool value); +std::string JSON_API valueToQuotedString(const char *value); + +/// \brief Output using the StyledStreamWriter. +/// \see Json::operator>>() +JSON_API std::ostream &operator<<(std::ostream &, const Value &root); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // JSON_WRITER_H_INCLUDED diff --git a/audofeed-device-backend/jsoncpp/json_batchallocator.h b/audofeed-device-backend/jsoncpp/json_batchallocator.h new file mode 100644 index 0000000..640d44d --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_batchallocator.h @@ -0,0 +1,122 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED +#define JSONCPP_BATCHALLOCATOR_H_INCLUDED + +#include +#include + +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +namespace Json { + +/* Fast memory allocator. + * + * This memory allocator allocates memory for a batch of object (specified by + * the page size, the number of object in each page). + * + * It does not allow the destruction of a single object. All the allocated + * objects can be destroyed at once. The memory can be either released or reused + * for future allocation. + * + * The in-place new operator must be used to construct the object using the + * pointer returned by allocate. + */ +template +class BatchAllocator { +public: + BatchAllocator(unsigned int objectsPerPage = 255) + : freeHead_(0), objectsPerPage_(objectsPerPage) { + // printf( "Size: %d => %s\n", sizeof(AllocatedType), + // typeid(AllocatedType).name() ); + assert(sizeof(AllocatedType) * objectPerAllocation >= + sizeof(AllocatedType *)); // We must be able to store a slist in the + // object free space. + assert(objectsPerPage >= 16); + batches_ = allocateBatch(0); // allocated a dummy page + currentBatch_ = batches_; + } + + ~BatchAllocator() { + for (BatchInfo *batch = batches_; batch;) { + BatchInfo *nextBatch = batch->next_; + free(batch); + batch = nextBatch; + } + } + + /// allocate space for an array of objectPerAllocation object. + /// @warning it is the responsability of the caller to call objects + /// constructors. + AllocatedType *allocate() { + if (freeHead_) // returns node from free list. + { + AllocatedType *object = freeHead_; + freeHead_ = *(AllocatedType **)object; + return object; + } + if (currentBatch_->used_ == currentBatch_->end_) { + currentBatch_ = currentBatch_->next_; + while (currentBatch_ && currentBatch_->used_ == currentBatch_->end_) + currentBatch_ = currentBatch_->next_; + + if (!currentBatch_) // no free batch found, allocate a new one + { + currentBatch_ = allocateBatch(objectsPerPage_); + currentBatch_->next_ = batches_; // insert at the head of the list + batches_ = currentBatch_; + } + } + AllocatedType *allocated = currentBatch_->used_; + currentBatch_->used_ += objectPerAllocation; + return allocated; + } + + /// Release the object. + /// @warning it is the responsability of the caller to actually destruct the + /// object. + void release(AllocatedType *object) { + assert(object != 0); + *(AllocatedType **)object = freeHead_; + freeHead_ = object; + } + +private: + struct BatchInfo { + BatchInfo *next_; + AllocatedType *used_; + AllocatedType *end_; + AllocatedType buffer_[objectPerAllocation]; + }; + + // disabled copy constructor and assignement operator. + BatchAllocator(const BatchAllocator &); + void operator=(const BatchAllocator &); + + static BatchInfo *allocateBatch(unsigned int objectsPerPage) { + const unsigned int mallocSize = + sizeof(BatchInfo) - sizeof(AllocatedType) * objectPerAllocation + + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage; + BatchInfo *batch = static_cast(malloc(mallocSize)); + batch->next_ = 0; + batch->used_ = batch->buffer_; + batch->end_ = batch->buffer_ + objectsPerPage; + return batch; + } + + BatchInfo *batches_; + BatchInfo *currentBatch_; + /// Head of a single linked list within the allocated space of freeed object + AllocatedType *freeHead_; + unsigned int objectsPerPage_; +}; + +} // namespace Json + +#endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION + +#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED +// vim: et ts=2 sts=2 sw=2 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_internalarray.inl b/audofeed-device-backend/jsoncpp/json_internalarray.inl new file mode 100644 index 0000000..d8af2f6 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_internalarray.inl @@ -0,0 +1,455 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueInternalArray +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueArrayAllocator::~ValueArrayAllocator() +{ +} + +// ////////////////////////////////////////////////////////////////// +// class DefaultValueArrayAllocator +// ////////////////////////////////////////////////////////////////// +#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + return new ValueInternalArray(); + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + return new ValueInternalArray( other ); + } + + virtual void destructArray( ValueInternalArray *array ) + { + delete array; + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + JSON_ASSERT_MESSAGE(newIndexes, "Couldn't realloc."); + indexCount = newIndexCount; + indexes = static_cast( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + free( value ); + } +}; + +#else // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +/// @todo make this thread-safe (lock when accessign batch allocator) +class DefaultValueArrayAllocator : public ValueArrayAllocator +{ +public: // overridden from ValueArrayAllocator + virtual ~DefaultValueArrayAllocator() + { + } + + virtual ValueInternalArray *newArray() + { + ValueInternalArray *array = arraysAllocator_.allocate(); + new (array) ValueInternalArray(); // placement new + return array; + } + + virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) + { + ValueInternalArray *array = arraysAllocator_.allocate(); + new (array) ValueInternalArray( other ); // placement new + return array; + } + + virtual void destructArray( ValueInternalArray *array ) + { + if ( array ) + { + array->~ValueInternalArray(); + arraysAllocator_.release( array ); + } + } + + virtual void reallocateArrayPageIndex( Value **&indexes, + ValueInternalArray::PageIndex &indexCount, + ValueInternalArray::PageIndex minNewIndexCount ) + { + ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; + if ( minNewIndexCount > newIndexCount ) + newIndexCount = minNewIndexCount; + void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); + JSON_ASSERT_MESSAGE(newIndexes, "Couldn't realloc."); + indexCount = newIndexCount; + indexes = static_cast( newIndexes ); + } + virtual void releaseArrayPageIndex( Value **indexes, + ValueInternalArray::PageIndex indexCount ) + { + if ( indexes ) + free( indexes ); + } + + virtual Value *allocateArrayPage() + { + return static_cast( pagesAllocator_.allocate() ); + } + + virtual void releaseArrayPage( Value *value ) + { + if ( value ) + pagesAllocator_.release( value ); + } +private: + BatchAllocator arraysAllocator_; + BatchAllocator pagesAllocator_; +}; +#endif // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR + +static ValueArrayAllocator *&arrayAllocator() +{ + static DefaultValueArrayAllocator defaultAllocator; + static ValueArrayAllocator *arrayAllocator = &defaultAllocator; + return arrayAllocator; +} + +static struct DummyArrayAllocatorInitializer { + DummyArrayAllocatorInitializer() + { + arrayAllocator(); // ensure arrayAllocator() statics are initialized before main(). + } +} dummyArrayAllocatorInitializer; + +// ////////////////////////////////////////////////////////////////// +// class ValueInternalArray +// ////////////////////////////////////////////////////////////////// +bool +ValueInternalArray::equals( const IteratorState &x, + const IteratorState &other ) +{ + return x.array_ == other.array_ + && x.currentItemIndex_ == other.currentItemIndex_ + && x.currentPageIndex_ == other.currentPageIndex_; +} + + +void +ValueInternalArray::increment( IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && + (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_ + != it.array_->size_, + "ValueInternalArray::increment(): moving iterator beyond end" ); + ++(it.currentItemIndex_); + if ( it.currentItemIndex_ == itemsPerPage ) + { + it.currentItemIndex_ = 0; + ++(it.currentPageIndex_); + } +} + + +void +ValueInternalArray::decrement( IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && it.currentPageIndex_ == it.array_->pages_ + && it.currentItemIndex_ == 0, + "ValueInternalArray::decrement(): moving iterator beyond end" ); + if ( it.currentItemIndex_ == 0 ) + { + it.currentItemIndex_ = itemsPerPage-1; + --(it.currentPageIndex_); + } + else + { + --(it.currentItemIndex_); + } +} + + +Value & +ValueInternalArray::unsafeDereference( const IteratorState &it ) +{ + return (*(it.currentPageIndex_))[it.currentItemIndex_]; +} + + +Value & +ValueInternalArray::dereference( const IteratorState &it ) +{ + JSON_ASSERT_MESSAGE( it.array_ && + (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_ + < it.array_->size_, + "ValueInternalArray::dereference(): dereferencing invalid iterator" ); + return unsafeDereference( it ); +} + +void +ValueInternalArray::makeBeginIterator( IteratorState &it ) const +{ + it.array_ = const_cast( this ); + it.currentItemIndex_ = 0; + it.currentPageIndex_ = pages_; +} + + +void +ValueInternalArray::makeIterator( IteratorState &it, ArrayIndex index ) const +{ + it.array_ = const_cast( this ); + it.currentItemIndex_ = index % itemsPerPage; + it.currentPageIndex_ = pages_ + index / itemsPerPage; +} + + +void +ValueInternalArray::makeEndIterator( IteratorState &it ) const +{ + makeIterator( it, size_ ); +} + + +ValueInternalArray::ValueInternalArray() + : pages_( 0 ) + , size_( 0 ) + , pageCount_( 0 ) +{ +} + + +ValueInternalArray::ValueInternalArray( const ValueInternalArray &other ) + : pages_( 0 ) + , size_( other.size_ ) + , pageCount_( 0 ) +{ + PageIndex minNewPages = other.size_ / itemsPerPage; + arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages ); + JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, + "ValueInternalArray::reserve(): bad reallocation" ); + IteratorState itOther; + other.makeBeginIterator( itOther ); + Value *value; + for ( ArrayIndex index = 0; index < size_; ++index, increment(itOther) ) + { + if ( index % itemsPerPage == 0 ) + { + PageIndex pageIndex = index / itemsPerPage; + value = arrayAllocator()->allocateArrayPage(); + pages_[pageIndex] = value; + } + new (value) Value( dereference( itOther ) ); + } +} + + +ValueInternalArray & +ValueInternalArray::operator =( const ValueInternalArray &other ) +{ + ValueInternalArray temp( other ); + swap( temp ); + return *this; +} + + +ValueInternalArray::~ValueInternalArray() +{ + // destroy all constructed items + IteratorState it; + IteratorState itEnd; + makeBeginIterator( it); + makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + value->~Value(); + } + // release all pages + PageIndex lastPageIndex = size_ / itemsPerPage; + for ( PageIndex pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex ) + arrayAllocator()->releaseArrayPage( pages_[pageIndex] ); + // release pages index + arrayAllocator()->releaseArrayPageIndex( pages_, pageCount_ ); +} + + +void +ValueInternalArray::swap( ValueInternalArray &other ) +{ + Value **tempPages = pages_; + pages_ = other.pages_; + other.pages_ = tempPages; + ArrayIndex tempSize = size_; + size_ = other.size_; + other.size_ = tempSize; + PageIndex tempPageCount = pageCount_; + pageCount_ = other.pageCount_; + other.pageCount_ = tempPageCount; +} + +void +ValueInternalArray::clear() +{ + ValueInternalArray dummy; + swap( dummy ); +} + + +void +ValueInternalArray::resize( ArrayIndex newSize ) +{ + if ( newSize == 0 ) + clear(); + else if ( newSize < size_ ) + { + IteratorState it; + IteratorState itEnd; + makeIterator( it, newSize ); + makeIterator( itEnd, size_ ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + value->~Value(); + } + PageIndex pageIndex = (newSize + itemsPerPage - 1) / itemsPerPage; + PageIndex lastPageIndex = size_ / itemsPerPage; + for ( ; pageIndex < lastPageIndex; ++pageIndex ) + arrayAllocator()->releaseArrayPage( pages_[pageIndex] ); + size_ = newSize; + } + else if ( newSize > size_ ) + resolveReference( newSize ); +} + + +void +ValueInternalArray::makeIndexValid( ArrayIndex index ) +{ + // Need to enlarge page index ? + if ( index >= pageCount_ * itemsPerPage ) + { + PageIndex minNewPages = (index + 1) / itemsPerPage; + arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages ); + JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, "ValueInternalArray::reserve(): bad reallocation" ); + } + + // Need to allocate new pages ? + ArrayIndex nextPageIndex = + (size_ % itemsPerPage) != 0 ? size_ - (size_%itemsPerPage) + itemsPerPage + : size_; + if ( nextPageIndex <= index ) + { + PageIndex pageIndex = nextPageIndex / itemsPerPage; + PageIndex pageToAllocate = (index - nextPageIndex) / itemsPerPage + 1; + for ( ; pageToAllocate-- > 0; ++pageIndex ) + pages_[pageIndex] = arrayAllocator()->allocateArrayPage(); + } + + // Initialize all new entries + IteratorState it; + IteratorState itEnd; + makeIterator( it, size_ ); + size_ = index + 1; + makeIterator( itEnd, size_ ); + for ( ; !equals(it,itEnd); increment(it) ) + { + Value *value = &dereference(it); + new (value) Value(); // Construct a default value using placement new + } +} + +Value & +ValueInternalArray::resolveReference( ArrayIndex index ) +{ + if ( index >= size_ ) + makeIndexValid( index ); + return pages_[index/itemsPerPage][index%itemsPerPage]; +} + +Value * +ValueInternalArray::find( ArrayIndex index ) const +{ + if ( index >= size_ ) + return 0; + return &(pages_[index/itemsPerPage][index%itemsPerPage]); +} + +ValueInternalArray::ArrayIndex +ValueInternalArray::size() const +{ + return size_; +} + +int +ValueInternalArray::distance( const IteratorState &x, const IteratorState &y ) +{ + return indexOf(y) - indexOf(x); +} + + +ValueInternalArray::ArrayIndex +ValueInternalArray::indexOf( const IteratorState &iterator ) +{ + if ( !iterator.array_ ) + return ArrayIndex(-1); + return ArrayIndex( + (iterator.currentPageIndex_ - iterator.array_->pages_) * itemsPerPage + + iterator.currentItemIndex_ ); +} + + +int +ValueInternalArray::compare( const ValueInternalArray &other ) const +{ + int sizeDiff( size_ - other.size_ ); + if ( sizeDiff != 0 ) + return sizeDiff; + + for ( ArrayIndex index =0; index < size_; ++index ) + { + int diff = pages_[index/itemsPerPage][index%itemsPerPage].compare( + other.pages_[index/itemsPerPage][index%itemsPerPage] ); + if ( diff != 0 ) + return diff; + } + return 0; +} + +} // namespace Json +// vim: et ts=3 sts=3 sw=3 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_internalmap.inl b/audofeed-device-backend/jsoncpp/json_internalmap.inl new file mode 100644 index 0000000..249aafa --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_internalmap.inl @@ -0,0 +1,616 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueInternalMap +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/** \internal MUST be safely initialized using memset( this, 0, sizeof(ValueInternalLink) ); + * This optimization is used by the fast allocator. + */ +ValueInternalLink::ValueInternalLink() + : previous_( 0 ) + , next_( 0 ) +{ +} + +ValueInternalLink::~ValueInternalLink() +{ + for ( int index =0; index < itemPerLink; ++index ) + { + if ( !items_[index].isItemAvailable() ) + { + if ( !items_[index].isMemberNameStatic() ) + free( keys_[index] ); + } + else + break; + } +} + + + +ValueMapAllocator::~ValueMapAllocator() +{ +} + +#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +class DefaultValueMapAllocator : public ValueMapAllocator +{ +public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + return new ValueInternalMap(); + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + return new ValueInternalMap( other ); + } + + virtual void destructMap( ValueInternalMap *map ) + { + delete map; + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + return new ValueInternalLink(); + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + delete link; + } +}; +#else +/// @todo make this thread-safe (lock when accessign batch allocator) +class DefaultValueMapAllocator : public ValueMapAllocator +{ +public: // overridden from ValueMapAllocator + virtual ValueInternalMap *newMap() + { + ValueInternalMap *map = mapsAllocator_.allocate(); + new (map) ValueInternalMap(); // placement new + return map; + } + + virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) + { + ValueInternalMap *map = mapsAllocator_.allocate(); + new (map) ValueInternalMap( other ); // placement new + return map; + } + + virtual void destructMap( ValueInternalMap *map ) + { + if ( map ) + { + map->~ValueInternalMap(); + mapsAllocator_.release( map ); + } + } + + virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) + { + return new ValueInternalLink[size]; + } + + virtual void releaseMapBuckets( ValueInternalLink *links ) + { + delete [] links; + } + + virtual ValueInternalLink *allocateMapLink() + { + ValueInternalLink *link = linksAllocator_.allocate(); + memset( link, 0, sizeof(ValueInternalLink) ); + return link; + } + + virtual void releaseMapLink( ValueInternalLink *link ) + { + link->~ValueInternalLink(); + linksAllocator_.release( link ); + } +private: + BatchAllocator mapsAllocator_; + BatchAllocator linksAllocator_; +}; +#endif + +static ValueMapAllocator *&mapAllocator() +{ + static DefaultValueMapAllocator defaultAllocator; + static ValueMapAllocator *mapAllocator = &defaultAllocator; + return mapAllocator; +} + +static struct DummyMapAllocatorInitializer { + DummyMapAllocatorInitializer() + { + mapAllocator(); // ensure mapAllocator() statics are initialized before main(). + } +} dummyMapAllocatorInitializer; + + + +// h(K) = value * K >> w ; with w = 32 & K prime w.r.t. 2^32. + +/* +use linked list hash map. +buckets array is a container. +linked list element contains 6 key/values. (memory = (16+4) * 6 + 4 = 124) +value have extra state: valid, available, deleted +*/ + + +ValueInternalMap::ValueInternalMap() + : buckets_( 0 ) + , tailLink_( 0 ) + , bucketsSize_( 0 ) + , itemCount_( 0 ) +{ +} + + +ValueInternalMap::ValueInternalMap( const ValueInternalMap &other ) + : buckets_( 0 ) + , tailLink_( 0 ) + , bucketsSize_( 0 ) + , itemCount_( 0 ) +{ + reserve( other.itemCount_ ); + IteratorState it; + IteratorState itEnd; + other.makeBeginIterator( it ); + other.makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + bool isStatic; + const char *memberName = key( it, isStatic ); + const Value &aValue = value( it ); + resolveReference(memberName, isStatic) = aValue; + } +} + + +ValueInternalMap & +ValueInternalMap::operator =( const ValueInternalMap &other ) +{ + ValueInternalMap dummy( other ); + swap( dummy ); + return *this; +} + + +ValueInternalMap::~ValueInternalMap() +{ + if ( buckets_ ) + { + for ( BucketIndex bucketIndex =0; bucketIndex < bucketsSize_; ++bucketIndex ) + { + ValueInternalLink *link = buckets_[bucketIndex].next_; + while ( link ) + { + ValueInternalLink *linkToRelease = link; + link = link->next_; + mapAllocator()->releaseMapLink( linkToRelease ); + } + } + mapAllocator()->releaseMapBuckets( buckets_ ); + } +} + + +void +ValueInternalMap::swap( ValueInternalMap &other ) +{ + ValueInternalLink *tempBuckets = buckets_; + buckets_ = other.buckets_; + other.buckets_ = tempBuckets; + ValueInternalLink *tempTailLink = tailLink_; + tailLink_ = other.tailLink_; + other.tailLink_ = tempTailLink; + BucketIndex tempBucketsSize = bucketsSize_; + bucketsSize_ = other.bucketsSize_; + other.bucketsSize_ = tempBucketsSize; + BucketIndex tempItemCount = itemCount_; + itemCount_ = other.itemCount_; + other.itemCount_ = tempItemCount; +} + + +void +ValueInternalMap::clear() +{ + ValueInternalMap dummy; + swap( dummy ); +} + + +ValueInternalMap::BucketIndex +ValueInternalMap::size() const +{ + return itemCount_; +} + +bool +ValueInternalMap::reserveDelta( BucketIndex growth ) +{ + return reserve( itemCount_ + growth ); +} + +bool +ValueInternalMap::reserve( BucketIndex newItemCount ) +{ + if ( !buckets_ && newItemCount > 0 ) + { + buckets_ = mapAllocator()->allocateMapBuckets( 1 ); + bucketsSize_ = 1; + tailLink_ = &buckets_[0]; + } +// BucketIndex idealBucketCount = (newItemCount + ValueInternalLink::itemPerLink) / ValueInternalLink::itemPerLink; + return true; +} + + +const Value * +ValueInternalMap::find( const char *key ) const +{ + if ( !bucketsSize_ ) + return 0; + HashKey hashedKey = hash( key ); + BucketIndex bucketIndex = hashedKey % bucketsSize_; + for ( const ValueInternalLink *current = &buckets_[bucketIndex]; + current != 0; + current = current->next_ ) + { + for ( BucketIndex index=0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( current->items_[index].isItemAvailable() ) + return 0; + if ( strcmp( key, current->keys_[index] ) == 0 ) + return ¤t->items_[index]; + } + } + return 0; +} + + +Value * +ValueInternalMap::find( const char *key ) +{ + const ValueInternalMap *constThis = this; + return const_cast( constThis->find( key ) ); +} + + +Value & +ValueInternalMap::resolveReference( const char *key, + bool isStatic ) +{ + HashKey hashedKey = hash( key ); + if ( bucketsSize_ ) + { + BucketIndex bucketIndex = hashedKey % bucketsSize_; + ValueInternalLink **previous = 0; + BucketIndex index; + for ( ValueInternalLink *current = &buckets_[bucketIndex]; + current != 0; + previous = ¤t->next_, current = current->next_ ) + { + for ( index=0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( current->items_[index].isItemAvailable() ) + return setNewItem( key, isStatic, current, index ); + if ( strcmp( key, current->keys_[index] ) == 0 ) + return current->items_[index]; + } + } + } + + reserveDelta( 1 ); + return unsafeAdd( key, isStatic, hashedKey ); +} + + +void +ValueInternalMap::remove( const char *key ) +{ + HashKey hashedKey = hash( key ); + if ( !bucketsSize_ ) + return; + BucketIndex bucketIndex = hashedKey % bucketsSize_; + for ( ValueInternalLink *link = &buckets_[bucketIndex]; + link != 0; + link = link->next_ ) + { + BucketIndex index; + for ( index =0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( link->items_[index].isItemAvailable() ) + return; + if ( strcmp( key, link->keys_[index] ) == 0 ) + { + doActualRemove( link, index, bucketIndex ); + return; + } + } + } +} + +void +ValueInternalMap::doActualRemove( ValueInternalLink *link, + BucketIndex index, + BucketIndex bucketIndex ) +{ + // find last item of the bucket and swap it with the 'removed' one. + // set removed items flags to 'available'. + // if last page only contains 'available' items, then desallocate it (it's empty) + ValueInternalLink *&lastLink = getLastLinkInBucket( index ); + BucketIndex lastItemIndex = 1; // a link can never be empty, so start at 1 + for ( ; + lastItemIndex < ValueInternalLink::itemPerLink; + ++lastItemIndex ) // may be optimized with dicotomic search + { + if ( lastLink->items_[lastItemIndex].isItemAvailable() ) + break; + } + + BucketIndex lastUsedIndex = lastItemIndex - 1; + Value *valueToDelete = &link->items_[index]; + Value *valueToPreserve = &lastLink->items_[lastUsedIndex]; + if ( valueToDelete != valueToPreserve ) + valueToDelete->swap( *valueToPreserve ); + if ( lastUsedIndex == 0 ) // page is now empty + { // remove it from bucket linked list and delete it. + ValueInternalLink *linkPreviousToLast = lastLink->previous_; + if ( linkPreviousToLast != 0 ) // can not deleted bucket link. + { + mapAllocator()->releaseMapLink( lastLink ); + linkPreviousToLast->next_ = 0; + lastLink = linkPreviousToLast; + } + } + else + { + Value dummy; + valueToPreserve->swap( dummy ); // restore deleted to default Value. + valueToPreserve->setItemUsed( false ); + } + --itemCount_; +} + + +ValueInternalLink *& +ValueInternalMap::getLastLinkInBucket( BucketIndex bucketIndex ) +{ + if ( bucketIndex == bucketsSize_ - 1 ) + return tailLink_; + ValueInternalLink *&previous = buckets_[bucketIndex+1].previous_; + if ( !previous ) + previous = &buckets_[bucketIndex]; + return previous; +} + + +Value & +ValueInternalMap::setNewItem( const char *key, + bool isStatic, + ValueInternalLink *link, + BucketIndex index ) +{ + char *duplicatedKey = makeMemberName( key ); + ++itemCount_; + link->keys_[index] = duplicatedKey; + link->items_[index].setItemUsed(); + link->items_[index].setMemberNameIsStatic( isStatic ); + return link->items_[index]; // items already default constructed. +} + + +Value & +ValueInternalMap::unsafeAdd( const char *key, + bool isStatic, + HashKey hashedKey ) +{ + JSON_ASSERT_MESSAGE( bucketsSize_ > 0, "ValueInternalMap::unsafeAdd(): internal logic error." ); + BucketIndex bucketIndex = hashedKey % bucketsSize_; + ValueInternalLink *&previousLink = getLastLinkInBucket( bucketIndex ); + ValueInternalLink *link = previousLink; + BucketIndex index; + for ( index =0; index < ValueInternalLink::itemPerLink; ++index ) + { + if ( link->items_[index].isItemAvailable() ) + break; + } + if ( index == ValueInternalLink::itemPerLink ) // need to add a new page + { + ValueInternalLink *newLink = mapAllocator()->allocateMapLink(); + index = 0; + link->next_ = newLink; + previousLink = newLink; + link = newLink; + } + return setNewItem( key, isStatic, link, index ); +} + + +ValueInternalMap::HashKey +ValueInternalMap::hash( const char *key ) const +{ + HashKey hash = 0; + while ( *key ) + hash += *key++ * 37; + return hash; +} + + +int +ValueInternalMap::compare( const ValueInternalMap &other ) const +{ + int sizeDiff( itemCount_ - other.itemCount_ ); + if ( sizeDiff != 0 ) + return sizeDiff; + // Strict order guaranty is required. Compare all keys FIRST, then compare values. + IteratorState it; + IteratorState itEnd; + makeBeginIterator( it ); + makeEndIterator( itEnd ); + for ( ; !equals(it,itEnd); increment(it) ) + { + if ( !other.find( key( it ) ) ) + return 1; + } + + // All keys are equals, let's compare values + makeBeginIterator( it ); + for ( ; !equals(it,itEnd); increment(it) ) + { + const Value *otherValue = other.find( key( it ) ); + int valueDiff = value(it).compare( *otherValue ); + if ( valueDiff != 0 ) + return valueDiff; + } + return 0; +} + + +void +ValueInternalMap::makeBeginIterator( IteratorState &it ) const +{ + it.map_ = const_cast( this ); + it.bucketIndex_ = 0; + it.itemIndex_ = 0; + it.link_ = buckets_; +} + + +void +ValueInternalMap::makeEndIterator( IteratorState &it ) const +{ + it.map_ = const_cast( this ); + it.bucketIndex_ = bucketsSize_; + it.itemIndex_ = 0; + it.link_ = 0; +} + + +bool +ValueInternalMap::equals( const IteratorState &x, const IteratorState &other ) +{ + return x.map_ == other.map_ + && x.bucketIndex_ == other.bucketIndex_ + && x.link_ == other.link_ + && x.itemIndex_ == other.itemIndex_; +} + + +void +ValueInternalMap::incrementBucket( IteratorState &iterator ) +{ + ++iterator.bucketIndex_; + JSON_ASSERT_MESSAGE( iterator.bucketIndex_ <= iterator.map_->bucketsSize_, + "ValueInternalMap::increment(): attempting to iterate beyond end." ); + if ( iterator.bucketIndex_ == iterator.map_->bucketsSize_ ) + iterator.link_ = 0; + else + iterator.link_ = &(iterator.map_->buckets_[iterator.bucketIndex_]); + iterator.itemIndex_ = 0; +} + + +void +ValueInternalMap::increment( IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterator using invalid iterator." ); + ++iterator.itemIndex_; + if ( iterator.itemIndex_ == ValueInternalLink::itemPerLink ) + { + JSON_ASSERT_MESSAGE( iterator.link_ != 0, + "ValueInternalMap::increment(): attempting to iterate beyond end." ); + iterator.link_ = iterator.link_->next_; + if ( iterator.link_ == 0 ) + incrementBucket( iterator ); + } + else if ( iterator.link_->items_[iterator.itemIndex_].isItemAvailable() ) + { + incrementBucket( iterator ); + } +} + + +void +ValueInternalMap::decrement( IteratorState &iterator ) +{ + if ( iterator.itemIndex_ == 0 ) + { + JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterate using invalid iterator." ); + if ( iterator.link_ == &iterator.map_->buckets_[iterator.bucketIndex_] ) + { + JSON_ASSERT_MESSAGE( iterator.bucketIndex_ > 0, "Attempting to iterate beyond beginning." ); + --(iterator.bucketIndex_); + } + iterator.link_ = iterator.link_->previous_; + iterator.itemIndex_ = ValueInternalLink::itemPerLink - 1; + } +} + + +const char * +ValueInternalMap::key( const IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + return iterator.link_->keys_[iterator.itemIndex_]; +} + +const char * +ValueInternalMap::key( const IteratorState &iterator, bool &isStatic ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + isStatic = iterator.link_->items_[iterator.itemIndex_].isMemberNameStatic(); + return iterator.link_->keys_[iterator.itemIndex_]; +} + + +Value & +ValueInternalMap::value( const IteratorState &iterator ) +{ + JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." ); + return iterator.link_->items_[iterator.itemIndex_]; +} + + +int +ValueInternalMap::distance( const IteratorState &x, const IteratorState &y ) +{ + int offset = 0; + IteratorState it = x; + while ( !equals( it, y ) ) + increment( it ); + return offset; +} + +} // namespace Json +// vim: et ts=3 sts=3 sw=3 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_reader.cpp b/audofeed-device-backend/jsoncpp/json_reader.cpp new file mode 100644 index 0000000..787d12a --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_reader.cpp @@ -0,0 +1,845 @@ +// Copyright 2007-2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +namespace Json { + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_(true), strictRoot_(false), + allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {} + +Features Features::all() { return Features(); } + +Features Features::strictMode() { + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + features.allowDroppedNullPlaceholders_ = false; + features.allowNumericKeys_ = false; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + +static inline bool in(Reader::Char c, + Reader::Char c1, + Reader::Char c2, + Reader::Char c3, + Reader::Char c4) { + return c == c1 || c == c2 || c == c3 || c == c4; +} + +static inline bool in(Reader::Char c, + Reader::Char c1, + Reader::Char c2, + Reader::Char c3, + Reader::Char c4, + Reader::Char c5) { + return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; +} + +static bool containsNewLine(Reader::Location begin, Reader::Location end) { + for (; begin < end; ++begin) + if (*begin == '\n' || *begin == '\r') + return true; + return false; +} + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(Features::all()), + collectComments_() {} + +Reader::Reader(const Features &features) + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(features), collectComments_() { +} + +bool +Reader::parse(const std::string &document, Value &root, bool collectComments) { + document_ = document; + const char *begin = document_.c_str(); + const char *end = begin + document_.length(); + return parse(begin, end, root, collectComments); +} + +bool Reader::parse(std::istream &sin, Value &root, bool collectComments) { + // std::istream_iterator begin(sin); + // std::istream_iterator end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse(doc, root, collectComments); +} + +bool Reader::parse(const char *beginDoc, + const char *endDoc, + Value &root, + bool collectComments) { + if (!features_.allowComments_) { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while (!nodes_.empty()) + nodes_.pop(); + nodes_.push(&root); + + bool successful = readValue(); + Token token; + skipCommentTokens(token); + if (collectComments_ && !commentsBefore_.empty()) + root.setComment(commentsBefore_, commentAfter); + if (features_.strictRoot_) { + if (!root.isArray() && !root.isObject()) { + // Set error location to start of doc, ideally should be first token found + // in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( + "A valid JSON document must be either an array or an object value.", + token); + return false; + } + } + return successful; +} + +bool Reader::readValue() { + Token token; + skipCommentTokens(token); + bool successful = true; + + if (collectComments_ && !commentsBefore_.empty()) { + // Remove newline characters at the end of the comments + size_t lastNonNewline = commentsBefore_.find_last_not_of("\r\n"); + if (lastNonNewline != std::string::npos) { + commentsBefore_.erase(lastNonNewline + 1); + } else { + commentsBefore_.clear(); + } + + currentValue().setComment(commentsBefore_, commentBefore); + commentsBefore_ = ""; + } + + switch (token.type_) { + case tokenObjectBegin: + successful = readObject(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenArrayBegin: + successful = readArray(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenNumber: + successful = decodeNumber(token); + break; + case tokenString: + successful = decodeString(token); + break; + case tokenTrue: + currentValue() = true; + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + break; + case tokenFalse: + currentValue() = false; + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + break; + case tokenNull: + currentValue() = Value(); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + break; + case tokenArraySeparator: + if (features_.allowDroppedNullPlaceholders_) { + // "Un-read" the current token and mark the current value as a null + // token. + current_--; + currentValue() = Value(); + currentValue().setOffsetStart(current_ - begin_ - 1); + currentValue().setOffsetLimit(current_ - begin_); + break; + } + // Else, fall through... + default: + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return addError("Syntax error: value, object or array expected.", token); + } + + if (collectComments_) { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + return successful; +} + +void Reader::skipCommentTokens(Token &token) { + if (features_.allowComments_) { + do { + readToken(token); + } while (token.type_ == tokenComment); + } else { + readToken(token); + } +} + +bool Reader::expectToken(TokenType type, Token &token, const char *message) { + readToken(token); + if (token.type_ != type) + return addError(message, token); + return true; +} + +bool Reader::readToken(Token &token) { + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch (c) { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match("rue", 3); + break; + case 'f': + token.type_ = tokenFalse; + ok = match("alse", 4); + break; + case 'n': + token.type_ = tokenNull; + ok = match("ull", 3); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if (!ok) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + +void Reader::skipSpaces() { + while (current_ != end_) { + Char c = *current_; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + ++current_; + else + break; + } +} + +bool Reader::match(Location pattern, int patternLength) { + if (end_ - current_ < patternLength) + return false; + int index = patternLength; + while (index--) + if (current_[index] != pattern[index]) + return false; + current_ += patternLength; + return true; +} + +bool Reader::readComment() { + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if (c == '*') + successful = readCStyleComment(); + else if (c == '/') + successful = readCppStyleComment(); + if (!successful) + return false; + + if (collectComments_) { + CommentPlacement placement = commentBefore; + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { + if (c != '*' || !containsNewLine(commentBegin, current_)) + placement = commentAfterOnSameLine; + } + + addComment(commentBegin, current_, placement); + } + return true; +} + +void +Reader::addComment(Location begin, Location end, CommentPlacement placement) { + assert(collectComments_); + if (placement == commentAfterOnSameLine) { + assert(lastValue_ != 0); + lastValue_->setComment(std::string(begin, end), placement); + } else { + if (!commentsBefore_.empty()) + commentsBefore_ += "\n"; + commentsBefore_ += std::string(begin, end); + } +} + +bool Reader::readCStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '*' && *current_ == '/') + break; + } + return getNextChar() == '/'; +} + +bool Reader::readCppStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '\r' || c == '\n') + break; + } + return true; +} + +void Reader::readNumber() { + while (current_ != end_) { + if (!(*current_ >= '0' && *current_ <= '9') && + !in(*current_, '.', 'e', 'E', '+', '-')) + break; + ++current_; + } +} + +bool Reader::readString() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '"') + break; + } + return c == '"'; +} + +bool Reader::readObject(Token &tokenStart) { + Token tokenName; + std::string name; + currentValue() = Value(objectValue); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + while (readToken(tokenName)) { + bool initialTokenOk = true; + while (tokenName.type_ == tokenComment && initialTokenOk) + initialTokenOk = readToken(tokenName); + if (!initialTokenOk) + break; + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object + return true; + name = ""; + if (tokenName.type_ == tokenString) { + if (!decodeString(tokenName, name)) + return recoverFromError(tokenObjectEnd); + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { + Value numberName; + if (!decodeNumber(tokenName, numberName)) + return recoverFromError(tokenObjectEnd); + name = numberName.asString(); + } else { + break; + } + + Token colon; + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { + return addErrorAndRecover( + "Missing ':' after object member name", colon, tokenObjectEnd); + } + Value &value = currentValue()[name]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenObjectEnd); + + Token comma; + if (!readToken(comma) || + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment)) { + return addErrorAndRecover( + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); + } + bool finalizeTokenOk = true; + while (comma.type_ == tokenComment && finalizeTokenOk) + finalizeTokenOk = readToken(comma); + if (comma.type_ == tokenObjectEnd) + return true; + } + return addErrorAndRecover( + "Missing '}' or object member name", tokenName, tokenObjectEnd); +} + +bool Reader::readArray(Token &tokenStart) { + currentValue() = Value(arrayValue); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + skipSpaces(); + if (*current_ == ']') // empty array + { + Token endArray; + readToken(endArray); + return true; + } + int index = 0; + for (;;) { + Value &value = currentValue()[index++]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenArrayEnd); + + Token token; + // Accept Comment after last item in the array. + ok = readToken(token); + while (token.type_ == tokenComment && ok) { + ok = readToken(token); + } + bool badTokenType = + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); + if (!ok || badTokenType) { + return addErrorAndRecover( + "Missing ',' or ']' in array declaration", token, tokenArrayEnd); + } + if (token.type_ == tokenArrayEnd) + break; + } + return true; +} + +bool Reader::decodeNumber(Token &token) { + Value decoded; + if (!decodeNumber(token, decoded)) + return false; + currentValue() = decoded; + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeNumber(Token &token, Value &decoded) { + bool isDouble = false; + for (Location inspect = token.start_; inspect != token.end_; ++inspect) { + isDouble = isDouble || in(*inspect, '.', 'e', 'E', '+') || + (*inspect == '-' && inspect != token.start_); + } + if (isDouble) + return decodeDouble(token, decoded); + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if (isNegative) + ++current; + Value::LargestUInt maxIntegerValue = + isNegative ? Value::LargestUInt(-Value::minLargestInt) + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while (current < token.end_) { + Char c = *current++; + if (c < '0' || c > '9') + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + Value::UInt digit(c - '0'); + if (value >= threshold) { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || current != token.end_ || + digit > maxIntegerValue % 10) { + return decodeDouble(token, decoded); + } + } + value = value * 10 + digit; + } + if (isNegative) + decoded = -Value::LargestInt(value); + else if (value <= Value::LargestUInt(Value::maxInt)) + decoded = Value::LargestInt(value); + else + decoded = value; + return true; +} + +bool Reader::decodeDouble(Token &token) { + Value decoded; + if (!decodeDouble(token, decoded)) + return false; + currentValue() = decoded; + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeDouble(Token &token, Value &decoded) { + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + + // Sanity check to avoid buffer overflow exploits. + if (length < 0) { + return addError("Unable to parse token length", token); + } + + // Avoid using a string constant for the format control string given to + // sscanf, as this can cause hard to debug crashes on OS X. See here for more + // info: + // + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html + char format[] = "%lf"; + + if (length <= bufferSize) { + Char buffer[bufferSize + 1]; + memcpy(buffer, token.start_, length); + buffer[length] = 0; + count = sscanf(buffer, format, &value); + } else { + std::string buffer(token.start_, token.end_); + count = sscanf(buffer.c_str(), format, &value); + } + + if (count != 1) + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + decoded = value; + return true; +} + +bool Reader::decodeString(Token &token) { + std::string decoded; + if (!decodeString(token, decoded)) + return false; + currentValue() = decoded; + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeString(Token &token, std::string &decoded) { + decoded.reserve(token.end_ - token.start_ - 2); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while (current != end) { + Char c = *current++; + if (c == '"') + break; + else if (c == '\\') { + if (current == end) + return addError("Empty escape sequence in string", token, current); + Char escape = *current++; + switch (escape) { + case '"': + decoded += '"'; + break; + case '/': + decoded += '/'; + break; + case '\\': + decoded += '\\'; + break; + case 'b': + decoded += '\b'; + break; + case 'f': + decoded += '\f'; + break; + case 'n': + decoded += '\n'; + break; + case 'r': + decoded += '\r'; + break; + case 't': + decoded += '\t'; + break; + case 'u': { + unsigned int unicode; + if (!decodeUnicodeCodePoint(token, current, end, unicode)) + return false; + decoded += codePointToUTF8(unicode); + } break; + default: + return addError("Bad escape sequence in string", token, current); + } + } else { + decoded += c; + } + } + return true; +} + +bool Reader::decodeUnicodeCodePoint(Token &token, + Location ¤t, + Location end, + unsigned int &unicode) { + + if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) { + // surrogate pairs + if (end - current < 6) + return addError( + "additional six characters expected to parse unicode surrogate pair.", + token, + current); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++) == 'u') { + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } else + return false; + } else + return addError("expecting another \\u token to begin the second half of " + "a unicode surrogate pair", + token, + current); + } + return true; +} + +bool Reader::decodeUnicodeEscapeSequence(Token &token, + Location ¤t, + Location end, + unsigned int &unicode) { + if (end - current < 4) + return addError( + "Bad unicode escape sequence in string: four digits expected.", + token, + current); + unicode = 0; + for (int index = 0; index < 4; ++index) { + Char c = *current++; + unicode *= 16; + if (c >= '0' && c <= '9') + unicode += c - '0'; + else if (c >= 'a' && c <= 'f') + unicode += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + unicode += c - 'A' + 10; + else + return addError( + "Bad unicode escape sequence in string: hexadecimal digit expected.", + token, + current); + } + return true; +} + +bool +Reader::addError(const std::string &message, Token &token, Location extra) { + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back(info); + return false; +} + +bool Reader::recoverFromError(TokenType skipUntilToken) { + int errorCount = int(errors_.size()); + Token skip; + for (;;) { + if (!readToken(skip)) + errors_.resize(errorCount); // discard errors caused by recovery + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) + break; + } + errors_.resize(errorCount); + return false; +} + +bool Reader::addErrorAndRecover(const std::string &message, + Token &token, + TokenType skipUntilToken) { + addError(message, token); + return recoverFromError(skipUntilToken); +} + +Value &Reader::currentValue() { return *(nodes_.top()); } + +Reader::Char Reader::getNextChar() { + if (current_ == end_) + return 0; + return *current_++; +} + +void Reader::getLocationLineAndColumn(Location location, + int &line, + int &column) const { + Location current = begin_; + Location lastLineStart = current; + line = 0; + while (current < location && current != end_) { + Char c = *current++; + if (c == '\r') { + if (*current == '\n') + ++current; + lastLineStart = current; + ++line; + } else if (c == '\n') { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + +std::string Reader::getLocationLineAndColumn(Location location) const { + int line, column; + getLocationLineAndColumn(location, line, column); + char buffer[18 + 16 + 16 + 1]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) + #if defined(WINCE) + _snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); + #else + sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column); + #endif +#else + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#endif + return buffer; +} + +// Deprecated. Preserved for backward compatibility +std::string Reader::getFormatedErrorMessages() const { + return getFormattedErrorMessages(); +} + +std::string Reader::getFormattedErrorMessages() const { + std::string formattedMessage; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo &error = *itError; + formattedMessage += + "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if (error.extra_) + formattedMessage += + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; + } + return formattedMessage; +} + +std::vector Reader::getStructuredErrors() const { + std::vector allErrors; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo &error = *itError; + Reader::StructuredError structured; + structured.offset_start = error.token_.start_ - begin_; + structured.offset_limit = error.token_.end_ - begin_; + structured.message = error.message_; + allErrors.push_back(structured); + } + return allErrors; +} + +std::istream &operator>>(std::istream &sin, Value &root) { + Json::Reader reader; + bool ok = reader.parse(sin, root, true); + if (!ok) { + fprintf(stderr, + "Error from reader: %s", + reader.getFormattedErrorMessages().c_str()); + + JSON_FAIL_MESSAGE("reader error"); + } + return sin; +} + +} // namespace Json +// vim: et ts=2 sts=2 sw=2 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_tool.h b/audofeed-device-backend/jsoncpp/json_tool.h new file mode 100644 index 0000000..ca18c49 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_tool.h @@ -0,0 +1,88 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED +#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +/* This header provides common string manipulation support, such as UTF-8, + * portable conversion from/to string... + * + * It is an internal header that must not be exposed. + */ + +namespace Json { + +/// Converts a unicode code-point to UTF-8. +static inline std::string codePointToUTF8(unsigned int cp) { + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) { + result.resize(1); + result[0] = static_cast(cp); + } else if (cp <= 0x7FF) { + result.resize(2); + result[1] = static_cast(0x80 | (0x3f & cp)); + result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); + } else if (cp <= 0xFFFF) { + result.resize(3); + result[2] = static_cast(0x80 | (0x3f & cp)); + result[1] = 0x80 | static_cast((0x3f & (cp >> 6))); + result[0] = 0xE0 | static_cast((0xf & (cp >> 12))); + } else if (cp <= 0x10FFFF) { + result.resize(4); + result[3] = static_cast(0x80 | (0x3f & cp)); + result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + +/// Returns true if ch is a control character (in range [0,32[). +static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; } + +enum { + /// Constant that specify the size of the buffer that must be passed to + /// uintToString. + uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 +}; + +// Defines a char buffer for use with uintToString(). +typedef char UIntToStringBuffer[uintToStringBufferSize]; + +/** Converts an unsigned integer to string. + * @param value Unsigned interger to convert to string + * @param current Input/Output string buffer. + * Must have at least uintToStringBufferSize chars free. + */ +static inline void uintToString(LargestUInt value, char *¤t) { + *--current = 0; + do { + *--current = char(value % 10) + '0'; + value /= 10; + } while (value != 0); +} + +/** Change ',' to '.' everywhere in buffer. + * + * We had a sophisticated way, but it did not work in WinCE. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9 + */ +static inline void fixNumericLocale(char* begin, char* end) { + while (begin < end) { + if (*begin == ',') { + *begin = '.'; + } + ++begin; + } +} + +} // namespace Json { + +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED +// vim: et ts=2 sts=2 sw=2 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_value.cpp b/audofeed-device-backend/jsoncpp/json_value.cpp new file mode 100644 index 0000000..4a5685a --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_value.cpp @@ -0,0 +1,1545 @@ +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +#include "json_batchallocator.h" +#endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#ifdef JSON_USE_CPPTL +#include +#endif +#include // size_t + +#define JSON_ASSERT_UNREACHABLE assert(false) + +namespace Json { + +// This is a walkaround to avoid the static initialization of Value::null. +// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of +// 8 (instead of 4) as a bit of future-proofing. +#if defined(__ARMEL__) +#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) +#else +#define ALIGNAS(byte_alignment) +#endif +static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0}; +const Value& Value::null = reinterpret_cast(kNull); + +const Int Value::minInt = Int(~(UInt(-1) / 2)); +const Int Value::maxInt = Int(UInt(-1) / 2); +const UInt Value::maxUInt = UInt(-1); +#if defined(JSON_HAS_INT64) +const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2)); +const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2); +const UInt64 Value::maxUInt64 = UInt64(-1); +// The constant is hard-coded because some compiler have trouble +// converting Value::maxUInt64 to a double correctly (AIX/xlC). +// Assumes that UInt64 is a 64 bits integer. +static const double maxUInt64AsDouble = 18446744073709551615.0; +#endif // defined(JSON_HAS_INT64) +const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2)); +const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2); +const LargestUInt Value::maxLargestUInt = LargestUInt(-1); + +/// Unknown size marker +static const unsigned int unknown = (unsigned)-1; + +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +template +static inline bool InRange(double d, T min, U max) { + return d >= min && d <= max; +} +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +static inline double integerToDouble(Json::UInt64 value) { + return static_cast(Int64(value / 2)) * 2.0 + Int64(value & 1); +} + +template static inline double integerToDouble(T value) { + return static_cast(value); +} + +template +static inline bool InRange(double d, T min, U max) { + return d >= integerToDouble(min) && d <= integerToDouble(max); +} +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + +/** Duplicates the specified string value. + * @param value Pointer to the string to duplicate. Must be zero-terminated if + * length is "unknown". + * @param length Length of the value. if equals to unknown, then it will be + * computed using strlen(value). + * @return Pointer on the duplicate instance of string. + */ +static inline char *duplicateStringValue(const char *value, + unsigned int length = unknown) { + if (length == unknown) + length = (unsigned int)strlen(value); + + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + if (length >= (unsigned)Value::maxInt) + length = Value::maxInt - 1; + + char *newString = static_cast(malloc(length + 1)); + JSON_ASSERT_MESSAGE(newString != 0, + "in Json::Value::duplicateStringValue(): " + "Failed to allocate string value buffer"); + memcpy(newString, value, length); + newString[length] = 0; + return newString; +} + +/** Free the string duplicated by duplicateStringValue(). + */ +static inline void releaseStringValue(char *value) { + if (value) + free(value); +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#if !defined(JSON_IS_AMALGAMATION) +#ifdef JSON_VALUE_USE_INTERNAL_MAP +#include "json_internalarray.inl" +#include "json_internalmap.inl" +#endif // JSON_VALUE_USE_INTERNAL_MAP + +#include "json_valueiterator.inl" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +Value::CommentInfo::CommentInfo() : comment_(0) {} + +Value::CommentInfo::~CommentInfo() { + if (comment_) + releaseStringValue(comment_); +} + +void Value::CommentInfo::setComment(const char *text) { + if (comment_) + releaseStringValue(comment_); + JSON_ASSERT(text != 0); + JSON_ASSERT_MESSAGE( + text[0] == '\0' || text[0] == '/', + "in Json::Value::setComment(): Comments must start with /"); + // It seems that /**/ style comments are acceptable as well. + comment_ = duplicateStringValue(text); +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#ifndef JSON_VALUE_USE_INTERNAL_MAP + +// Notes: index_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {} + +Value::CZString::CZString(const char *cstr, DuplicationPolicy allocate) + : cstr_(allocate == duplicate ? duplicateStringValue(cstr) : cstr), + index_(allocate) {} + +Value::CZString::CZString(const CZString &other) + : cstr_(other.index_ != noDuplication && other.cstr_ != 0 + ? duplicateStringValue(other.cstr_) + : other.cstr_), + index_(other.cstr_ + ? (other.index_ == noDuplication ? noDuplication : duplicate) + : other.index_) {} + +Value::CZString::~CZString() { + if (cstr_ && index_ == duplicate) + releaseStringValue(const_cast(cstr_)); +} + +void Value::CZString::swap(CZString &other) { + std::swap(cstr_, other.cstr_); + std::swap(index_, other.index_); +} + +Value::CZString &Value::CZString::operator=(const CZString &other) { + CZString temp(other); + swap(temp); + return *this; +} + +bool Value::CZString::operator<(const CZString &other) const { + if (cstr_) + return strcmp(cstr_, other.cstr_) < 0; + return index_ < other.index_; +} + +bool Value::CZString::operator==(const CZString &other) const { + if (cstr_) + return strcmp(cstr_, other.cstr_) == 0; + return index_ == other.index_; +} + +ArrayIndex Value::CZString::index() const { return index_; } + +const char *Value::CZString::c_str() const { return cstr_; } + +bool Value::CZString::isStaticString() const { return index_ == noDuplication; } + +#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value(ValueType type) + : type_(type), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + switch (type) { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArray(); + break; + case objectValue: + value_.map_ = mapAllocator()->newMap(); + break; +#endif + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + +Value::Value(UInt value) + : type_(uintValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.uint_ = value; +} + +Value::Value(Int value) + : type_(intValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.int_ = value; +} + +#if defined(JSON_HAS_INT64) +Value::Value(Int64 value) + : type_(intValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.int_ = value; +} + +Value::Value(UInt64 value) + : type_(uintValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.uint_ = value; +} +#endif // defined(JSON_HAS_INT64) + +Value::Value(double value) + : type_(realValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.real_ = value; +} + +Value::Value(const char *value) + : type_(stringValue), allocated_(true) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.string_ = duplicateStringValue(value); +} + +Value::Value(const char *beginValue, const char *endValue) + : type_(stringValue), allocated_(true) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.string_ = + duplicateStringValue(beginValue, (unsigned int)(endValue - beginValue)); +} + +Value::Value(const std::string &value) + : type_(stringValue), allocated_(true) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.string_ = + duplicateStringValue(value.c_str(), (unsigned int)value.length()); +} + +Value::Value(const StaticString &value) + : type_(stringValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.string_ = const_cast(value.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value::Value(const CppTL::ConstString &value) + : type_(stringValue), allocated_(true) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.string_ = duplicateStringValue(value, value.length()); +} +#endif + +Value::Value(bool value) + : type_(booleanValue), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(0), limit_(0) { + value_.bool_ = value; +} + +Value::Value(const Value &other) + : type_(other.type_), allocated_(false) +#ifdef JSON_VALUE_USE_INTERNAL_MAP + , + itemIsUsed_(0) +#endif + , + comments_(0), start_(other.start_), limit_(other.limit_) { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if (other.value_.string_) { + value_.string_ = duplicateStringValue(other.value_.string_); + allocated_ = true; + } else { + value_.string_ = 0; + allocated_ = false; + } + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(*other.value_.map_); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArrayCopy(*other.value_.array_); + break; + case objectValue: + value_.map_ = mapAllocator()->newMapCopy(*other.value_.map_); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + if (other.comments_) { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for (int comment = 0; comment < numberOfCommentPlacement; ++comment) { + const CommentInfo &otherComment = other.comments_[comment]; + if (otherComment.comment_) + comments_[comment].setComment(otherComment.comment_); + } + } +} + +Value::~Value() { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if (allocated_) + releaseStringValue(value_.string_); + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + delete value_.map_; + break; +#else + case arrayValue: + arrayAllocator()->destructArray(value_.array_); + break; + case objectValue: + mapAllocator()->destructMap(value_.map_); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + + if (comments_) + delete[] comments_; +} + +Value &Value::operator=(const Value &other) { + Value temp(other); + swap(temp); + return *this; +} + +void Value::swap(Value &other) { + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap(value_, other.value_); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2; + std::swap(start_, other.start_); + std::swap(limit_, other.limit_); +} + +ValueType Value::type() const { return type_; } + +int Value::compare(const Value &other) const { + if (*this < other) + return -1; + if (*this > other) + return 1; + return 0; +} + +bool Value::operator<(const Value &other) const { + int typeDelta = type_ - other.type_; + if (typeDelta) + return typeDelta < 0 ? true : false; + switch (type_) { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + return (value_.string_ == 0 && other.value_.string_) || + (other.value_.string_ && value_.string_ && + strcmp(value_.string_, other.value_.string_) < 0); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: { + int delta = int(value_.map_->size() - other.value_.map_->size()); + if (delta) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } +#else + case arrayValue: + return value_.array_->compare(*(other.value_.array_)) < 0; + case objectValue: + return value_.map_->compare(*(other.value_.map_)) < 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator<=(const Value &other) const { return !(other < *this); } + +bool Value::operator>=(const Value &other) const { return !(*this < other); } + +bool Value::operator>(const Value &other) const { return other < *this; } + +bool Value::operator==(const Value &other) const { + // if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if (type_ != temp) + return false; + switch (type_) { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + return (value_.string_ == other.value_.string_) || + (other.value_.string_ && value_.string_ && + strcmp(value_.string_, other.value_.string_) == 0); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() && + (*value_.map_) == (*other.value_.map_); +#else + case arrayValue: + return value_.array_->compare(*(other.value_.array_)) == 0; + case objectValue: + return value_.map_->compare(*(other.value_.map_)) == 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator!=(const Value &other) const { return !(*this == other); } + +const char *Value::asCString() const { + JSON_ASSERT_MESSAGE(type_ == stringValue, + "in Json::Value::asCString(): requires stringValue"); + return value_.string_; +} + +std::string Value::asString() const { + switch (type_) { + case nullValue: + return ""; + case stringValue: + return value_.string_ ? value_.string_ : ""; + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + return valueToString(value_.int_); + case uintValue: + return valueToString(value_.uint_); + case realValue: + return valueToString(value_.real_); + default: + JSON_FAIL_MESSAGE("Type is not convertible to string"); + } +} + +#ifdef JSON_USE_CPPTL +CppTL::ConstString Value::asConstString() const { + return CppTL::ConstString(asString().c_str()); +} +#endif + +Value::Int Value::asInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range"); + return Int(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range"); + return Int(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), + "double out of Int range"); + return Int(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int."); +} + +Value::UInt Value::asUInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range"); + return UInt(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range"); + return UInt(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt), + "double out of UInt range"); + return UInt(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt."); +} + +#if defined(JSON_HAS_INT64) + +Value::Int64 Value::asInt64() const { + switch (type_) { + case intValue: + return Int64(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); + return Int64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), + "double out of Int64 range"); + return Int64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int64."); +} + +Value::UInt64 Value::asUInt64() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); + return UInt64(value_.int_); + case uintValue: + return UInt64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), + "double out of UInt64 range"); + return UInt64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); +} +#endif // if defined(JSON_HAS_INT64) + +LargestInt Value::asLargestInt() const { +#if defined(JSON_NO_INT64) + return asInt(); +#else + return asInt64(); +#endif +} + +LargestUInt Value::asLargestUInt() const { +#if defined(JSON_NO_INT64) + return asUInt(); +#else + return asUInt64(); +#endif +} + +double Value::asDouble() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return value_.real_; + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to double."); +} + +float Value::asFloat() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return static_cast(value_.real_); + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0f : 0.0f; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to float."); +} + +bool Value::asBool() const { + switch (type_) { + case booleanValue: + return value_.bool_; + case nullValue: + return false; + case intValue: + return value_.int_ ? true : false; + case uintValue: + return value_.uint_ ? true : false; + case realValue: + return value_.real_ ? true : false; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to bool."); +} + +bool Value::isConvertibleTo(ValueType other) const { + switch (other) { + case nullValue: + return (isNumeric() && asDouble() == 0.0) || + (type_ == booleanValue && value_.bool_ == false) || + (type_ == stringValue && asString() == "") || + (type_ == arrayValue && value_.map_->size() == 0) || + (type_ == objectValue && value_.map_->size() == 0) || + type_ == nullValue; + case intValue: + return isInt() || + (type_ == realValue && InRange(value_.real_, minInt, maxInt)) || + type_ == booleanValue || type_ == nullValue; + case uintValue: + return isUInt() || + (type_ == realValue && InRange(value_.real_, 0, maxUInt)) || + type_ == booleanValue || type_ == nullValue; + case realValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case booleanValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case stringValue: + return isNumeric() || type_ == booleanValue || type_ == stringValue || + type_ == nullValue; + case arrayValue: + return type_ == arrayValue || type_ == nullValue; + case objectValue: + return type_ == objectValue || type_ == nullValue; + } + JSON_ASSERT_UNREACHABLE; + return false; +} + +/// Number of values in array or object +ArrayIndex Value::size() const { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: // size of the array is highest index + 1 + if (!value_.map_->empty()) { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index() + 1; + } + return 0; + case objectValue: + return ArrayIndex(value_.map_->size()); +#else + case arrayValue: + return Int(value_.array_->size()); + case objectValue: + return Int(value_.map_->size()); +#endif + } + JSON_ASSERT_UNREACHABLE; + return 0; // unreachable; +} + +bool Value::empty() const { + if (isNull() || isArray() || isObject()) + return size() == 0u; + else + return false; +} + +bool Value::operator!() const { return isNull(); } + +void Value::clear() { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue || + type_ == objectValue, + "in Json::Value::clear(): requires complex value"); + start_ = 0; + limit_ = 0; + switch (type_) { +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_->clear(); + break; +#else + case arrayValue: + value_.array_->clear(); + break; + case objectValue: + value_.map_->clear(); + break; +#endif + default: + break; + } +} + +void Value::resize(ArrayIndex newSize) { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, + "in Json::Value::resize(): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ArrayIndex oldSize = size(); + if (newSize == 0) + clear(); + else if (newSize > oldSize) + (*this)[newSize - 1]; + else { + for (ArrayIndex index = newSize; index < oldSize; ++index) { + value_.map_->erase(index); + } + assert(size() == newSize); + } +#else + value_.array_->resize(newSize); +#endif +} + +Value &Value::operator[](ArrayIndex index) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key(index); + ObjectValues::iterator it = value_.map_->lower_bound(key); + if (it != value_.map_->end() && (*it).first == key) + return (*it).second; + + ObjectValues::value_type defaultValue(key, null); + it = value_.map_->insert(it, defaultValue); + return (*it).second; +#else + return value_.array_->resolveReference(index); +#endif +} + +Value &Value::operator[](int index) { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index): index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +const Value &Value::operator[](ArrayIndex index) const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex)const: requires arrayValue"); + if (type_ == nullValue) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key(index); + ObjectValues::const_iterator it = value_.map_->find(key); + if (it == value_.map_->end()) + return null; + return (*it).second; +#else + Value *value = value_.array_->find(index); + return value ? *value : null; +#endif +} + +const Value &Value::operator[](int index) const { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index) const: index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +Value &Value::operator[](const char *key) { + return resolveReference(key, false); +} + +Value &Value::resolveReference(const char *key, bool isStatic) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::resolveReference(): requires objectValue"); + if (type_ == nullValue) + *this = Value(objectValue); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( + key, isStatic ? CZString::noDuplication : CZString::duplicateOnCopy); + ObjectValues::iterator it = value_.map_->lower_bound(actualKey); + if (it != value_.map_->end() && (*it).first == actualKey) + return (*it).second; + + ObjectValues::value_type defaultValue(actualKey, null); + it = value_.map_->insert(it, defaultValue); + Value &value = (*it).second; + return value; +#else + return value_.map_->resolveReference(key, isStatic); +#endif +} + +Value Value::get(ArrayIndex index, const Value &defaultValue) const { + const Value *value = &((*this)[index]); + return value == &null ? defaultValue : *value; +} + +bool Value::isValidIndex(ArrayIndex index) const { return index < size(); } + +const Value &Value::operator[](const char *key) const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::operator[](char const*)const: requires objectValue"); + if (type_ == nullValue) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey(key, CZString::noDuplication); + ObjectValues::const_iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) + return null; + return (*it).second; +#else + const Value *value = value_.map_->find(key); + return value ? *value : null; +#endif +} + +Value &Value::operator[](const std::string &key) { + return (*this)[key.c_str()]; +} + +const Value &Value::operator[](const std::string &key) const { + return (*this)[key.c_str()]; +} + +Value &Value::operator[](const StaticString &key) { + return resolveReference(key, true); +} + +#ifdef JSON_USE_CPPTL +Value &Value::operator[](const CppTL::ConstString &key) { + return (*this)[key.c_str()]; +} + +const Value &Value::operator[](const CppTL::ConstString &key) const { + return (*this)[key.c_str()]; +} +#endif + +Value &Value::append(const Value &value) { return (*this)[size()] = value; } + +Value Value::get(const char *key, const Value &defaultValue) const { + const Value *value = &((*this)[key]); + return value == &null ? defaultValue : *value; +} + +Value Value::get(const std::string &key, const Value &defaultValue) const { + return get(key.c_str(), defaultValue); +} + +Value Value::removeMember(const char *key) { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue, + "in Json::Value::removeMember(): requires objectValue"); + if (type_ == nullValue) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey(key, CZString::noDuplication); + ObjectValues::iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) + return null; + Value old(it->second); + value_.map_->erase(it); + return old; +#else + Value *value = value_.map_->find(key); + if (value) { + Value old(*value); + value_.map_.remove(key); + return old; + } else { + return null; + } +#endif +} + +Value Value::removeMember(const std::string &key) { + return removeMember(key.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value Value::get(const CppTL::ConstString &key, + const Value &defaultValue) const { + return get(key.c_str(), defaultValue); +} +#endif + +bool Value::isMember(const char *key) const { + const Value *value = &((*this)[key]); + return value != &null; +} + +bool Value::isMember(const std::string &key) const { + return isMember(key.c_str()); +} + +#ifdef JSON_USE_CPPTL +bool Value::isMember(const CppTL::ConstString &key) const { + return isMember(key.c_str()); +} +#endif + +Value::Members Value::getMemberNames() const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::getMemberNames(), value must be objectValue"); + if (type_ == nullValue) + return Value::Members(); + Members members; + members.reserve(value_.map_->size()); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for (; it != itEnd; ++it) + members.push_back(std::string((*it).first.c_str())); +#else + ValueInternalMap::IteratorState it; + ValueInternalMap::IteratorState itEnd; + value_.map_->makeBeginIterator(it); + value_.map_->makeEndIterator(itEnd); + for (; !ValueInternalMap::equals(it, itEnd); ValueInternalMap::increment(it)) + members.push_back(std::string(ValueInternalMap::key(it))); +#endif + return members; +} +// +//# ifdef JSON_USE_CPPTL +// EnumMemberNames +// Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +// EnumValues +// Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type() ); +// return EnumValues(); +//} +// +//# endif + +static bool IsIntegral(double d) { + double integral_part; + return modf(d, &integral_part) == 0.0; +} + +bool Value::isNull() const { return type_ == nullValue; } + +bool Value::isBool() const { return type_ == booleanValue; } + +bool Value::isInt() const { + switch (type_) { + case intValue: + return value_.int_ >= minInt && value_.int_ <= maxInt; + case uintValue: + return value_.uint_ <= UInt(maxInt); + case realValue: + return value_.real_ >= minInt && value_.real_ <= maxInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isUInt() const { + switch (type_) { + case intValue: + return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt); + case uintValue: + return value_.uint_ <= maxUInt; + case realValue: + return value_.real_ >= 0 && value_.real_ <= maxUInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return true; + case uintValue: + return value_.uint_ <= UInt64(maxInt64); + case realValue: + // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a + // double, so double(maxInt64) will be rounded up to 2^63. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= double(minInt64) && + value_.real_ < double(maxInt64) && IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isUInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return value_.int_ >= 0; + case uintValue: + return true; + case realValue: + // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a + // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && + IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isIntegral() const { +#if defined(JSON_HAS_INT64) + return isInt64() || isUInt64(); +#else + return isInt() || isUInt(); +#endif +} + +bool Value::isDouble() const { return type_ == realValue || isIntegral(); } + +bool Value::isNumeric() const { return isIntegral() || isDouble(); } + +bool Value::isString() const { return type_ == stringValue; } + +bool Value::isArray() const { return type_ == arrayValue; } + +bool Value::isObject() const { return type_ == objectValue; } + +void Value::setComment(const char *comment, CommentPlacement placement) { + if (!comments_) + comments_ = new CommentInfo[numberOfCommentPlacement]; + comments_[placement].setComment(comment); +} + +void Value::setComment(const std::string &comment, CommentPlacement placement) { + setComment(comment.c_str(), placement); +} + +bool Value::hasComment(CommentPlacement placement) const { + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string Value::getComment(CommentPlacement placement) const { + if (hasComment(placement)) + return comments_[placement].comment_; + return ""; +} + +void Value::setOffsetStart(size_t start) { start_ = start; } + +void Value::setOffsetLimit(size_t limit) { limit_ = limit; } + +size_t Value::getOffsetStart() const { return start_; } + +size_t Value::getOffsetLimit() const { return limit_; } + +std::string Value::toStyledString() const { + StyledWriter writer; + return writer.write(*this); +} + +Value::const_iterator Value::begin() const { + switch (type_) { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if (value_.array_) { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator(it); + return const_iterator(it); + } + break; + case objectValue: + if (value_.map_) { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator(it); + return const_iterator(it); + } + break; +#else + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->begin()); + break; +#endif + default: + break; + } + return const_iterator(); +} + +Value::const_iterator Value::end() const { + switch (type_) { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if (value_.array_) { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator(it); + return const_iterator(it); + } + break; + case objectValue: + if (value_.map_) { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator(it); + return const_iterator(it); + } + break; +#else + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->end()); + break; +#endif + default: + break; + } + return const_iterator(); +} + +Value::iterator Value::begin() { + switch (type_) { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if (value_.array_) { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator(it); + return iterator(it); + } + break; + case objectValue: + if (value_.map_) { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator(it); + return iterator(it); + } + break; +#else + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->begin()); + break; +#endif + default: + break; + } + return iterator(); +} + +Value::iterator Value::end() { + switch (type_) { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if (value_.array_) { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator(it); + return iterator(it); + } + break; + case objectValue: + if (value_.map_) { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator(it); + return iterator(it); + } + break; +#else + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->end()); + break; +#endif + default: + break; + } + return iterator(); +} + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {} + +PathArgument::PathArgument(ArrayIndex index) + : key_(), index_(index), kind_(kindIndex) {} + +PathArgument::PathArgument(const char *key) + : key_(key), index_(), kind_(kindKey) {} + +PathArgument::PathArgument(const std::string &key) + : key_(key.c_str()), index_(), kind_(kindKey) {} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path(const std::string &path, + const PathArgument &a1, + const PathArgument &a2, + const PathArgument &a3, + const PathArgument &a4, + const PathArgument &a5) { + InArgs in; + in.push_back(&a1); + in.push_back(&a2); + in.push_back(&a3); + in.push_back(&a4); + in.push_back(&a5); + makePath(path, in); +} + +void Path::makePath(const std::string &path, const InArgs &in) { + const char *current = path.c_str(); + const char *end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while (current != end) { + if (*current == '[') { + ++current; + if (*current == '%') + addPathInArg(path, in, itInArg, PathArgument::kindIndex); + else { + ArrayIndex index = 0; + for (; current != end && *current >= '0' && *current <= '9'; ++current) + index = index * 10 + ArrayIndex(*current - '0'); + args_.push_back(index); + } + if (current == end || *current++ != ']') + invalidPath(path, int(current - path.c_str())); + } else if (*current == '%') { + addPathInArg(path, in, itInArg, PathArgument::kindKey); + ++current; + } else if (*current == '.') { + ++current; + } else { + const char *beginName = current; + while (current != end && !strchr("[.", *current)) + ++current; + args_.push_back(std::string(beginName, current)); + } + } +} + +void Path::addPathInArg(const std::string & /*path*/, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind) { + if (itInArg == in.end()) { + // Error: missing argument %d + } else if ((*itInArg)->kind_ != kind) { + // Error: bad argument type + } else { + args_.push_back(**itInArg); + } +} + +void Path::invalidPath(const std::string & /*path*/, int /*location*/) { + // Error: invalid path. +} + +const Value &Path::resolve(const Value &root) const { + const Value *node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument &arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if (node == &Value::null) { + // Error: unable to resolve path (object has no member named '' at + // position...) + } + } + } + return *node; +} + +Value Path::resolve(const Value &root, const Value &defaultValue) const { + const Value *node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument &arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) + return defaultValue; + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) + return defaultValue; + node = &((*node)[arg.key_]); + if (node == &Value::null) + return defaultValue; + } + } + return *node; +} + +Value &Path::make(Value &root) const { + Value *node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument &arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray()) { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + +} // namespace Json +// vim: et ts=2 sts=2 sw=2 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_valueiterator.inl b/audofeed-device-backend/jsoncpp/json_valueiterator.inl new file mode 100644 index 0000000..ab63eb5 --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_valueiterator.inl @@ -0,0 +1,301 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() +#ifndef JSON_VALUE_USE_INTERNAL_MAP + : current_() + , isNull_( true ) +{ +} +#else + : isArray_( true ) + , isNull_( true ) +{ + iterator_.array_ = ValueInternalArray::IteratorState(); +} +#endif + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator ¤t ) + : current_( current ) + , isNull_( false ) +{ +} +#else +ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state ) + : isArray_( true ) +{ + iterator_.array_ = state; +} + + +ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state ) + : isArray_( false ) +{ + iterator_.map_ = state; +} +#endif + +Value & +ValueIteratorBase::deref() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + return current_->second; +#else + if ( isArray_ ) + return ValueInternalArray::dereference( iterator_.array_ ); + return ValueInternalMap::value( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::increment() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ++current_; +#else + if ( isArray_ ) + ValueInternalArray::increment( iterator_.array_ ); + ValueInternalMap::increment( iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::decrement() +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + --current_; +#else + if ( isArray_ ) + ValueInternalArray::decrement( iterator_.array_ ); + ValueInternalMap::decrement( iterator_.map_ ); +#endif +} + + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP +# ifdef JSON_USE_CPPTL_SMALLMAP + return current_ - other.current_; +# else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if ( isNull_ && other.isNull_ ) + { + return 0; + } + + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it ) + { + ++myDistance; + } + return myDistance; +# endif +#else + if ( isArray_ ) + return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +bool +ValueIteratorBase::isEqual( const SelfType &other ) const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + if ( isNull_ ) + { + return other.isNull_; + } + return current_ == other.current_; +#else + if ( isArray_ ) + return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ ); + return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ ); +#endif +} + + +void +ValueIteratorBase::copy( const SelfType &other ) +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + current_ = other.current_; + isNull_ = other.isNull_; +#else + if ( isArray_ ) + iterator_.array_ = other.iterator_.array_; + iterator_.map_ = other.iterator_.map_; +#endif +} + + +Value +ValueIteratorBase::key() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( czstring.c_str() ) + { + if ( czstring.isStaticString() ) + return Value( StaticString( czstring.c_str() ) ); + return Value( czstring.c_str() ); + } + return Value( czstring.index() ); +#else + if ( isArray_ ) + return Value( ValueInternalArray::indexOf( iterator_.array_ ) ); + bool isStatic; + const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic ); + if ( isStatic ) + return Value( StaticString( memberName ) ); + return Value( memberName ); +#endif +} + + +UInt +ValueIteratorBase::index() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const Value::CZString czstring = (*current_).first; + if ( !czstring.c_str() ) + return czstring.index(); + return Value::UInt( -1 ); +#else + if ( isArray_ ) + return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) ); + return Value::UInt( -1 ); +#endif +} + + +const char * +ValueIteratorBase::memberName() const +{ +#ifndef JSON_VALUE_USE_INTERNAL_MAP + const char *name = (*current_).first.c_str(); + return name ? name : ""; +#else + if ( !isArray_ ) + return ValueInternalMap::key( iterator_.map_ ); + return ""; +#endif +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueConstIterator & +ValueConstIterator::operator =( const ValueIteratorBase &other ) +{ + copy( other ); + return *this; +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() +{ +} + + +#ifndef JSON_VALUE_USE_INTERNAL_MAP +ValueIterator::ValueIterator( const Value::ObjectValues::iterator ¤t ) + : ValueIteratorBase( current ) +{ +} +#else +ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} + +ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state ) + : ValueIteratorBase( state ) +{ +} +#endif + +ValueIterator::ValueIterator( const ValueConstIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator::ValueIterator( const ValueIterator &other ) + : ValueIteratorBase( other ) +{ +} + +ValueIterator & +ValueIterator::operator =( const SelfType &other ) +{ + copy( other ); + return *this; +} + +} // namespace Json +// vim: et ts=3 sts=3 sw=3 tw=0 diff --git a/audofeed-device-backend/jsoncpp/json_writer.cpp b/audofeed-device-backend/jsoncpp/json_writer.cpp new file mode 100644 index 0000000..2861ece --- /dev/null +++ b/audofeed-device-backend/jsoncpp/json_writer.cpp @@ -0,0 +1,666 @@ +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +namespace Json { + +static bool containsControlCharacter(const char *str) { + while (*str) { + if (isControlCharacter(*(str++))) + return true; + } + return false; +} + +std::string valueToString(LargestInt value) { + UIntToStringBuffer buffer; + char *current = buffer + sizeof(buffer); + bool isNegative = value < 0; + if (isNegative) + value = -value; + uintToString(LargestUInt(value), current); + if (isNegative) + *--current = '-'; + assert(current >= buffer); + return current; +} + +std::string valueToString(LargestUInt value) { + UIntToStringBuffer buffer; + char *current = buffer + sizeof(buffer); + uintToString(value, current); + assert(current >= buffer); + return current; +} + +#if defined(JSON_HAS_INT64) + +std::string valueToString(Int value) { + return valueToString(LargestInt(value)); +} + +std::string valueToString(UInt value) { + return valueToString(LargestUInt(value)); +} + +#endif // # if defined(JSON_HAS_INT64) + +std::string valueToString(double value) { + // Allocate a buffer that is more than large enough to store the 16 digits of + // precision requested below. + char buffer[32]; + +// Print into the buffer. We need not request the alternative representation +// that always has a decimal point because JSON doesn't distingish the +// concepts of reals and integers. +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with + // visual studio 2005 to + // avoid warning. + #if defined(WINCE) + _snprintf(buffer, sizeof(buffer), "%.16g", value); + #else + sprintf_s(buffer, sizeof(buffer), "%.16g", value); + #endif +#else + snprintf(buffer, sizeof(buffer), "%.16g", value); +#endif + fixNumericLocale(buffer, buffer + strlen(buffer)); + return buffer; +} + +std::string valueToString(bool value) { return value ? "true" : "false"; } + +std::string valueToQuotedString(const char *value) { + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && + !containsControlCharacter(value)) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = + strlen(value) * 2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char *c = value; *c != 0; ++c) { + switch (*c) { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + // case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } else { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() {} + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false) {} + +void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; } + +void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; } + +std::string FastWriter::write(const Value &root) { + document_ = ""; + writeValue(root); + document_ += "\n"; + return document_; +} + +void FastWriter::writeValue(const Value &value) { + switch (value.type()) { + case nullValue: + if (!dropNullPlaceholders_) + document_ += "null"; + break; + case intValue: + document_ += valueToString(value.asLargestInt()); + break; + case uintValue: + document_ += valueToString(value.asLargestUInt()); + break; + case realValue: + document_ += valueToString(value.asDouble()); + break; + case stringValue: + document_ += valueToQuotedString(value.asCString()); + break; + case booleanValue: + document_ += valueToString(value.asBool()); + break; + case arrayValue: { + document_ += "["; + int size = value.size(); + for (int index = 0; index < size; ++index) { + if (index > 0) + document_ += ","; + writeValue(value[index]); + } + document_ += "]"; + } break; + case objectValue: { + Value::Members members(value.getMemberNames()); + document_ += "{"; + for (Value::Members::iterator it = members.begin(); it != members.end(); + ++it) { + const std::string &name = *it; + if (it != members.begin()) + document_ += ","; + document_ += valueToQuotedString(name.c_str()); + document_ += yamlCompatiblityEnabled_ ? ": " : ":"; + writeValue(value[name]); + } + document_ += "}"; + } break; + } +} + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_(74), indentSize_(3), addChildValues_() {} + +std::string StyledWriter::write(const Value &root) { + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue(root); + writeValue(root); + writeCommentAfterValueOnSameLine(root); + document_ += "\n"; + return document_; +} + +void StyledWriter::writeValue(const Value &value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + pushValue(valueToQuotedString(value.asCString())); + break; + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + document_ += " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledWriter::writeArrayValue(const Value &value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value &childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + writeIndent(); + writeValue(childValue); + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + document_ += "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + +bool StyledWriter::isMultineArray(const Value &value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value &childValue = value[index]; + isMultiLine = + isMultiLine || ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledWriter::pushValue(const std::string &value) { + if (addChildValues_) + childValues_.push_back(value); + else + document_ += value; +} + +void StyledWriter::writeIndent() { + if (!document_.empty()) { + char last = document_[document_.length() - 1]; + if (last == ' ') // already indented + return; + if (last != '\n') // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + +void StyledWriter::writeWithIndent(const std::string &value) { + writeIndent(); + document_ += value; +} + +void StyledWriter::indent() { indentString_ += std::string(indentSize_, ' '); } + +void StyledWriter::unindent() { + assert(int(indentString_.size()) >= indentSize_); + indentString_.resize(indentString_.size() - indentSize_); +} + +void StyledWriter::writeCommentBeforeValue(const Value &root) { + if (!root.hasComment(commentBefore)) + return; + + document_ += "\n"; + writeIndent(); + std::string normalizedComment = normalizeEOL(root.getComment(commentBefore)); + std::string::const_iterator iter = normalizedComment.begin(); + while (iter != normalizedComment.end()) { + document_ += *iter; + if (*iter == '\n' && *(iter + 1) == '/') + writeIndent(); + ++iter; + } + + // Comments are stripped of newlines, so add one here + document_ += "\n"; +} + +void StyledWriter::writeCommentAfterValueOnSameLine(const Value &root) { + if (root.hasComment(commentAfterOnSameLine)) + document_ += " " + normalizeEOL(root.getComment(commentAfterOnSameLine)); + + if (root.hasComment(commentAfter)) { + document_ += "\n"; + document_ += normalizeEOL(root.getComment(commentAfter)); + document_ += "\n"; + } +} + +bool StyledWriter::hasCommentForValue(const Value &value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +std::string StyledWriter::normalizeEOL(const std::string &text) { + std::string normalized; + normalized.reserve(text.length()); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while (current != end) { + char c = *current++; + if (c == '\r') // mac or dos EOL + { + if (*current == '\n') // convert dos EOL + ++current; + normalized += '\n'; + } else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter(std::string indentation) + : document_(NULL), rightMargin_(74), indentation_(indentation), + addChildValues_() {} + +void StyledStreamWriter::write(std::ostream &out, const Value &root) { + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue(root); + writeValue(root); + writeCommentAfterValueOnSameLine(root); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + +void StyledStreamWriter::writeValue(const Value &value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + pushValue(valueToQuotedString(value.asCString())); + break; + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + *document_ << " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledStreamWriter::writeArrayValue(const Value &value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value &childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + writeIndent(); + writeValue(childValue); + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + *document_ << "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + +bool StyledStreamWriter::isMultineArray(const Value &value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value &childValue = value[index]; + isMultiLine = + isMultiLine || ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledStreamWriter::pushValue(const std::string &value) { + if (addChildValues_) + childValues_.push_back(value); + else + *document_ << value; +} + +void StyledStreamWriter::writeIndent() { + /* + Some comments in this method would have been nice. ;-) + + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + *document_ << '\n'; + } + */ + *document_ << '\n' << indentString_; +} + +void StyledStreamWriter::writeWithIndent(const std::string &value) { + writeIndent(); + *document_ << value; +} + +void StyledStreamWriter::indent() { indentString_ += indentation_; } + +void StyledStreamWriter::unindent() { + assert(indentString_.size() >= indentation_.size()); + indentString_.resize(indentString_.size() - indentation_.size()); +} + +void StyledStreamWriter::writeCommentBeforeValue(const Value &root) { + if (!root.hasComment(commentBefore)) + return; + *document_ << normalizeEOL(root.getComment(commentBefore)); + *document_ << "\n"; +} + +void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value &root) { + if (root.hasComment(commentAfterOnSameLine)) + *document_ << " " + normalizeEOL(root.getComment(commentAfterOnSameLine)); + + if (root.hasComment(commentAfter)) { + *document_ << "\n"; + *document_ << normalizeEOL(root.getComment(commentAfter)); + *document_ << "\n"; + } +} + +bool StyledStreamWriter::hasCommentForValue(const Value &value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +std::string StyledStreamWriter::normalizeEOL(const std::string &text) { + std::string normalized; + normalized.reserve(text.length()); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while (current != end) { + char c = *current++; + if (c == '\r') // mac or dos EOL + { + if (*current == '\n') // convert dos EOL + ++current; + normalized += '\n'; + } else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + +std::ostream &operator<<(std::ostream &sout, const Value &root) { + Json::StyledStreamWriter writer; + writer.write(sout, root); + return sout; +} + +} // namespace Json +// vim: et ts=2 sts=2 sw=2 tw=0 diff --git a/audofeed-device-backend/main.cc b/audofeed-device-backend/main.cc new file mode 100644 index 0000000..7537afd --- /dev/null +++ b/audofeed-device-backend/main.cc @@ -0,0 +1,107 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Local.Status.pb.h" +#include "Local.Status.grpc.pb.h" +#include +#include "easylogging++.h" + + + + + +struct FrontendSampleData { + bool device_status; + std::string device_id; + std::string soft_version; + uint64_t heart_time; + uint32_t mqtt_status; + uint32_t mqtt_delay; + uint64_t mqtt_last_up; + uint64_t mqtt_last_down; + uint32_t feed_count; + uint32_t feed_weight; + std::string last_feed_time; + std::string last_feed_weight; + uint32_t food_remain; + uint32_t temperature; + bool motor; + bool weight; + bool door; + bool stuck; +}; + +FrontendSampleData BuildFrontendSampleData() { + const uint64_t now = static_cast(std::time(nullptr)); + FrontendSampleData sample; + sample.device_status = true; + sample.device_id = "AF-2100"; + sample.soft_version = "1.4.2"; + sample.heart_time = now; + sample.mqtt_status = 1; + sample.mqtt_delay = 42; + sample.mqtt_last_up = now - 2; + sample.mqtt_last_down = now - 1; + sample.feed_count = 1; + sample.feed_weight = 20; + sample.last_feed_time = "2024-01-01 13:00:00"; + sample.last_feed_weight = "20g"; + sample.food_remain = 70; + sample.temperature = 28; + sample.motor = true; + sample.weight = true; + sample.door = true; + sample.stuck = false; + return sample; +} + +bool RunFrontendInteractionTest(const std::string& target, const FrontendSampleData& sample) { + LocalStatusClient client( + grpc::CreateChannel(target, grpc::InsecureChannelCredentials())); + + LocalDeviceRes device_res; + const bool device_ok = client.Device(sample.device_status, sample.device_id, + sample.soft_version, sample.heart_time, &device_res); + + LocalMqttRes mqtt_res; + const bool mqtt_ok = client.Mqtt(sample.mqtt_status, sample.mqtt_delay, + sample.mqtt_last_up, sample.mqtt_last_down, &mqtt_res); + + LocalFeedRes feed_res; + const bool feed_ok = client.Feed(sample.feed_count, sample.feed_weight, + sample.last_feed_time, sample.last_feed_weight, &feed_res); + + LocalHardRes hard_res; + const bool hard_ok = client.Hard(sample.food_remain, sample.temperature, + sample.motor, sample.weight, sample.door, sample.stuck, &hard_res); + LOG(INFO) << "Frontend test result: device=" << device_ok + << ", mqtt=" << mqtt_ok + << ", feed=" << feed_ok + << ", hard=" << hard_ok; + return device_ok && mqtt_ok && feed_ok && hard_ok; +} + +void RunFrontendInteractionTest(const std::string& target) { + const FrontendSampleData sample = BuildFrontendSampleData(); + RunFrontendInteractionTest(target, sample); +} + +INITIALIZE_EASYLOGGINGPP + + +int main(int argc, char** argv) { + std::string mode = argc > 1 ? argv[1] : "server"; + if (mode == "client") { + std::string target = argc > 2 ? argv[2] : kDefaultClientTarget; + RunFrontendInteractionTest(target); + return 0; + } + + return 1; +} diff --git a/audofeed-device-backend/mqtt/mqtt.cc b/audofeed-device-backend/mqtt/mqtt.cc new file mode 100644 index 0000000..63f5371 --- /dev/null +++ b/audofeed-device-backend/mqtt/mqtt.cc @@ -0,0 +1,207 @@ +#include "mqtt.hh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "easylogging++.h" + +MosquittoLibInit::MosquittoLibInit() { mosquitto_lib_init(); } + +MosquittoLibInit::~MosquittoLibInit() { mosquitto_lib_cleanup(); } + +MosquittoLibInit& MosquittoLibInit::get_instance() { + static MosquittoLibInit inst; + return inst; +} + +static MosquittoLibInit g_mosq_guard; + +MqttClient::MqttClient(const std::string& host, const uint16_t& port, int keepalive, std::string clientid, bool clean_session): host_(std::move(host)), + port_(port), + clientid_(std::move(clientid)), + clean_session_(clean_session), + keepalive_(keepalive) { + + mosq_ = mosquitto_new(clientid_.empty() ? nullptr : clientid_.c_str(), clean_session_, this); + + if (!mosq_) { + throw std::runtime_error("mosquitto_new failed"); + } + + int rc = mosquitto_threaded_set(mosq_, true); + if (rc != MOSQ_ERR_SUCCESS) { + throw std::runtime_error(std::string("mosquitto_threaded_set failed: ") + + mosquitto_strerror(rc)); + } + + mosquitto_connect_callback_set(mosq_, handle_connect); + mosquitto_disconnect_callback_set(mosq_, handle_disconnect); + mosquitto_message_callback_set(mosq_, handle_message); +} + +MqttClient::~MqttClient() { + stop_ = true; + + if (loop_thread_.joinable()) { + loop_thread_.join(); + } + + if (mosq_) { + mosquitto_destroy(mosq_); + mosq_ = nullptr; + } +} + +bool MqttClient::connect(int timeout_ms) { + std::lock_guard lock(mutex_); + + if (pwdneed_ == true) { + int rc = mosquitto_username_pw_set(mosq_, username_.c_str(), userpwd_.c_str()); + if (rc != MOSQ_ERR_SUCCESS) { + log_mqttclient_error("mosquitto_username_pw_set failed: ", rc); + return false; + } + } + + int rc = mosquitto_connect(mosq_, host_.c_str(), port_, keepalive_); + if (rc != MOSQ_ERR_SUCCESS) { + log_mqttclient_error("mosquitto_connect failed: ", rc); + return false; + } + + stop_ = false; + loop_thread_ = std::thread(&MqttClient::loop_thread_function, this); + + auto start = std::chrono::steady_clock::now(); + while (!connected_) { + auto now = std::chrono::steady_clock::now(); + if (std::chrono::duration_cast(now - start).count() > timeout_ms) { + LOG(INFO) << "MQTT connect timeout\n"; + return false; + } + + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + } + + return true; +} +void MqttClient::disconnect() { + std::lock_guard lock(mutex_); + + if (!mosq_) { + return; + } + + mosquitto_destroy(mosq_); + stop_ = true; +} + +void MqttClient::set_auth(const char* username, const char* userpwd) { + username_ = username; + userpwd_ = userpwd; + pwdneed_ = true; +} + +bool MqttClient::publish(const std::string& topic, +const void* payload, +size_t len, +int qos, +bool retain) { + std::lock_guard lock(mutex_); + if (!mosq_) { + return false; + } + + int mid = 0; + int rc = mosquitto_publish(mosq_, &mid, topic.c_str(), static_cast(len), payload, qos, retain); + + if (rc != MOSQ_ERR_SUCCESS) { + log_mqttclient_error("mosquitto_publish failed: ", rc); + return false; + } + + return true; +} + +bool MqttClient::publish(const std::string& topic, const std::string& paylod, int qos, bool retain) { + return publish(topic, paylod.data(), paylod.size(), qos, retain); +} + +bool MqttClient::subscribe(const std::string& topic, int qos, MessageHandler cb) { + std::lock_guard lock(mutex_); + + if (!mosq_) { + return false; + } + + int rc = mosquitto_subscribe(mosq_, nullptr, topic.c_str(), qos); + + if (rc != MOSQ_ERR_SUCCESS) { + log_mqttclient_error("mosquitto_subscribe failed: ", rc); + return false; + } + + handers_[topic] = std::move(cb); + return true; +} + +void MqttClient::handle_connect(mosquitto* mosq, void* obj, int rc) { + auto* self = static_cast(obj); + if (rc == 0) { + self->connected_ = true; + LOG(INFO) << "MQTT connected: " << self->host_ << ":" << self->port_; + } + else { + LOG(ERROR) << "MQTT connect failed: " << self->host_ << ":" << self->port_; + } +} + +void MqttClient::handle_disconnect(mosquitto* mosq, void* obj, int rc) { + auto* self = static_cast(obj); + self->connected_ = false; + LOG(INFO) << "MQTT disconnected: " << self->host_ << ":" << self->port_; +} + +void MqttClient::handle_message(mosquitto* mosq, void* obj, const mosquitto_message* msg) { + auto* self = static_cast(obj); + if (!msg || !msg->payload) { + return; + } + + std::string topic = msg->topic; + std::vector payload; + if (msg->payload && msg->payloadlen > 0) { + auto* p = static_cast(msg->payload); + payload.assign(p, p + msg->payloadlen); + } + + std::lock_guard lock(self->mutex_); + auto ite = self->handers_.find(topic); + if (ite != self->handers_.end()) { + ite->second(topic, payload, msg->qos, msg->retain); + } +} + +void MqttClient::loop_thread_function() { + while (!stop_) { + int rc = mosquitto_loop(mosq_, 100, 1); + if (stop_) { + break; + } + if (rc != MOSQ_ERR_SUCCESS) { + connected_ = false; + log_mqttclient_error("mosquitto_loop error: ", rc); + std::this_thread::sleep_for(std::chrono::seconds(1)); + mosquitto_reconnect(mosq_); + } + } +} + +void MqttClient::log_mqttclient_error(const std::string& error_str, int rc) { + LOG(ERROR) << error_str << mosquitto_strerror(rc); +} \ No newline at end of file diff --git a/audofeed-device-backend/mqtt/mqtt.hh b/audofeed-device-backend/mqtt/mqtt.hh new file mode 100644 index 0000000..51cb5a8 --- /dev/null +++ b/audofeed-device-backend/mqtt/mqtt.hh @@ -0,0 +1,75 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class MosquittoLibInit { +public: + MosquittoLibInit(); + ~MosquittoLibInit(); + + static MosquittoLibInit& get_instance(); +}; + +class MqttClient { +public: + using MessageHandler = std::function& payload, + int qos, + bool retain)>; + + MqttClient(const std::string& host, const uint16_t& port, int keepalive = 60, std::string clientid = {}, bool clean_session = true); + + ~MqttClient(); + + MqttClient(const MqttClient&) = delete; + MqttClient& operator=(const MqttClient&) = delete; + + bool connect(int timeout_ms = 3000); + void disconnect(); + + bool publish(const std::string& topic, const void* payload, size_t len, int qos = 0, bool retain = false); + + bool publish(const std::string& topic, const std::string& paylod, int qos = 0, bool retain = false); + + bool subscribe(const std::string& topic, int qos, MessageHandler cb); + + bool isconnect(); + + void set_auth(const char* username, const char* userpwd); + +private: + static void handle_connect(mosquitto* mosq, void* obj, int rc); + static void handle_disconnect(mosquitto* mosq, void* obj, int rc); + static void handle_message(mosquitto* mosq, void* obj, const mosquitto_message* msg); + + void loop_thread_function(); + + static void log_mqttclient_error(const std::string& error_str, int rc); + +private: + std::string host_; + uint16_t port_; + std::string clientid_; + bool clean_session_; + int keepalive_; + + mosquitto* mosq_ = nullptr; + std::atomic connected_{ false }; + std::atomic stop_{ true }; + std::thread loop_thread_; + std::mutex mutex_; + + std::string username_; + std::string userpwd_; + std::atomic pwdneed_{ false }; + + std::unordered_map handers_; +}; \ No newline at end of file diff --git a/audofeed-device-backend/mqtt/mqtt_app.cc b/audofeed-device-backend/mqtt/mqtt_app.cc new file mode 100644 index 0000000..cdf918c --- /dev/null +++ b/audofeed-device-backend/mqtt/mqtt_app.cc @@ -0,0 +1,27 @@ +#include "mqtt/mqtt_app.hh" +#include "jsoncpp/json/json.h" +#include "jsoncpp/json/value.h" +#include "jsoncpp/json/writer.h" +#include + +using namespace af::mqtt::v1; + +void MqttApp::app_publish_state(State state) { + std::string payload; + uint8_t mask = static_cast(state); + encode_state_json(mask, payload); + mqtt_client_->publish(Topics::state(topic_contex_), payload, 1, false); +} + +void MqttApp::encode_state_json(uint8_t mask, std::string& str_json) { + Json::Value root; + root["version"] = "v1"; + root["state"] = mask; + root["left"] = 0; + Json::FastWriter write; + str_json = write.write(root); +} + +void MqttApp::init_topic_feed_callback() { + mqtt_client_->subscribe(Topics::cmd_ack(topic_contex_, "feed"), 0, nullptr); +} \ No newline at end of file diff --git a/audofeed-device-backend/mqtt/mqtt_app.hh b/audofeed-device-backend/mqtt/mqtt_app.hh new file mode 100644 index 0000000..9b4b2ca --- /dev/null +++ b/audofeed-device-backend/mqtt/mqtt_app.hh @@ -0,0 +1,193 @@ +#ifndef MQTT_APP_H +#define MQTT_APP_H +#include +#include +#include +#include +#include "mqtt.hh" +#include +#include +#include +#include +#include "localstatusclient.h" + +namespace { +std::string read_file_trim(const std::string& path) { + std::ifstream ifs(path); + std::string s, line; + if (!ifs) return {}; + while (std::getline(ifs, line)) { + s += line; + } + // 简单 trim + while (!s.empty() && (s.back() == '\n' || s.back() == '\r' || s.back() == ' ')) + s.pop_back(); + return s; +} + +std::string get_machine_id() { + std::string id = read_file_trim("/etc/machine-id"); + if (id.empty()) + id = read_file_trim("/var/lib/dbus/machine-id"); + return id; +} +} // namespace + + +namespace af::mqtt::v1 { + +enum class Env { + Dev, + Test, + Prod +}; + +inline std::string_view env_to_sv(Env e) noexcept { + switch (e) { + case Env::Dev: + return "dev"; + case Env::Test: + return "test"; + case Env::Prod: + return "prod"; + } + + return "test"; +} + +struct TopicContext { + Env env{ Env::Test }; + std::string deviceId = get_machine_id(); + + TopicContext() = default; + TopicContext(Env e): env(e) {} +}; + +class Topics { +public: + static std::string base(const TopicContext& c) { + return std::format("af/v1/{}/{}", env_to_sv(c.env), c.deviceId); + } + + static std::string state(const TopicContext& c) { + return std::format("{}/state", base(c)); + } + + static std::string telemetry(const TopicContext& c) { // retain=false + return std::format("{}/telemetry", base(c)); + } + + // event/ e.g. boot, feed_done, jam, low_food, lid_open, fault, ota + static std::string event(const TopicContext& c, std::string_view type) { + return std::format("{}/event/{}", base(c), type); + } + + // cmd/ack/ e.g. feed, stop_feed, feed_plan_set + static std::string cmd_ack(const TopicContext& c, std::string_view cmd) { + return std::format("{}/cmd/ack/{}", base(c), cmd); + } + + // cmd/res/ + static std::string cmd_res(const TopicContext& c, std::string_view cmd) { + return std::format("{}/cmd/res/{}", base(c), cmd); + } + + // config/ack + static std::string config_ack(const TopicContext& c) { + return std::format("{}/config/ack", base(c)); + } + + // stream/state + static std::string stream_state(const TopicContext& c) { + return std::format("{}/stream/state", base(c)); + } + + // stream/event/ + static std::string stream_event(const TopicContext& c, std::string_view type) { + return std::format("{}/stream/event/{}", base(c), type); + } + + // log/ debug|info|warn|error + static std::string log(const TopicContext& c, std::string_view level) { + return std::format("{}/log/{}", base(c), level); + } + + // ---------- Server -> Device (subscribe) ---------- + // Subscribe to all commands: + static std::string sub_cmd_all(const TopicContext& c) { // .../cmd/+ + return std::format("{}/cmd/+", base(c)); + } + + // Or build specific cmd topic for debugging/testing: + static std::string cmd(const TopicContext& c, std::string_view cmd) { // .../cmd/ + return std::format("{}/cmd/{}", base(c), cmd); + } + + // config/set + static std::string sub_config_set(const TopicContext& c) { + return std::format("{}/config/set", base(c)); + } + + // ota/notify + static std::string sub_ota_notify(const TopicContext& c) { + return std::format("{}/ota/notify", base(c)); + } + + // stream/cmd/+ + static std::string sub_stream_cmd_all(const TopicContext& c) { + return std::format("{}/stream/cmd/+", base(c)); + } + + // For testing: stream/cmd/ (start/stop) + static std::string stream_cmd(const TopicContext& c, std::string_view cmd) { + return std::format("{}/stream/cmd/{}", base(c), cmd); + } + + // ---------- Helpers (recommended topic constants) ---------- + // Common cmd names + static constexpr std::string_view CMD_FEED = "feed"; + static constexpr std::string_view CMD_STOP_FEED = "stop_feed"; + static constexpr std::string_view CMD_PLAN_SET = "feed_plan_set"; + static constexpr std::string_view CMD_PLAN_GET = "feed_plan_get"; + static constexpr std::string_view CMD_PING = "ping"; + + // Common event types + static constexpr std::string_view EVT_BOOT = "boot"; + static constexpr std::string_view EVT_FEED_DONE = "feed_done"; + static constexpr std::string_view EVT_JAM = "jam"; + static constexpr std::string_view EVT_LOW_FOOD = "low_food"; + static constexpr std::string_view EVT_LID_OPEN = "lid_open"; + static constexpr std::string_view EVT_FAULT = "fault"; + static constexpr std::string_view EVT_OTA = "ota"; + + // Common stream event types + static constexpr std::string_view STRM_EVT_ERROR = "error"; + static constexpr std::string_view STRM_EVT_CLIENT_JOIN = "client_join"; + static constexpr std::string_view STRM_EVT_CLIENT_LEAVE = "client_leave"; + static constexpr std::string_view STRM_EVT_BITRATE_DROP = "bitrate_drop"; +}; + +enum class State { + Online = 0x01, + Free = 0x02, + Feed = 0x04, + Push = 0x08, +}; + +class MqttApp { +public: +private: + void app_publish_state(State state); + + void encode_state_json(uint8_t mask, std::string& str_json); + + void init_topic_feed_callback(); + +private: + std::unique_ptr mqtt_client_; + std::unique_ptr rpc_client_; + // std::unique_ptr timer_ = std::make_unique(); + TopicContext topic_contex_{}; +}; +} // namespace af::mqtt::v1 +#endif \ No newline at end of file diff --git a/audofeed-device-backend/proto/Local.Status.proto b/audofeed-device-backend/proto/Local.Status.proto new file mode 100644 index 0000000..ef86dde --- /dev/null +++ b/audofeed-device-backend/proto/Local.Status.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; +package Local.Status; + +service LocalStatus { + rpc Device(LocalDeviceReq) returns (LocalDeviceRes) {} + rpc Mqtt(LocalMqttReq) returns (LocalMqttRes) {} + rpc Feed(LocalFeedReq) returns (LocalFeedRes) {} + rpc Hard(LocalHardReq) returns (LocalHardRes) {} +} + +message LocalDeviceReq { + bool status = 1; + string device_id = 2; + string soft_version = 3; + uint64 heart_time = 4; + +} + +message LocalDeviceRes { + string device_id = 1; + string soft_version = 2; + uint32 result_code = 3; +} + +message LocalMqttReq { + uint32 status = 1; + uint32 delay = 2; + uint64 last_up = 3; + uint64 last_down = 4; +} + +message LocalMqttRes { + uint32 result_code = 1; +} + +message LocalFeedReq { + uint32 feed_count = 1; + uint32 feed_weight = 2; + string last_feed_time = 3; + string last_feed_weight = 4; +} + +message LocalFeedRes { + uint32 result_code = 1; +} + +message LocalHardReq { + uint32 food_remain = 1; + uint32 temperature = 2; + bool motor = 3; + bool weight = 4; + bool door = 5; + bool stuck = 6; +} + +message LocalHardRes { + uint32 action = 1; + uint32 result_code = 2; +} \ No newline at end of file diff --git a/audofeed-device-backend/rpc/Local.Status.grpc.pb.cc b/audofeed-device-backend/rpc/Local.Status.grpc.pb.cc new file mode 100644 index 0000000..0f033a8 --- /dev/null +++ b/audofeed-device-backend/rpc/Local.Status.grpc.pb.cc @@ -0,0 +1,214 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: Local.Status.proto + +#include "Local.Status.pb.h" +#include "Local.Status.grpc.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace Local { +namespace Status { + +static const char* LocalStatus_method_names[] = { + "/Local.Status.LocalStatus/Device", + "/Local.Status.LocalStatus/Mqtt", + "/Local.Status.LocalStatus/Feed", + "/Local.Status.LocalStatus/Hard", +}; + +std::unique_ptr< LocalStatus::Stub> LocalStatus::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { + (void)options; + std::unique_ptr< LocalStatus::Stub> stub(new LocalStatus::Stub(channel, options)); + return stub; +} + +LocalStatus::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) + : channel_(channel), rpcmethod_Device_(LocalStatus_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_Mqtt_(LocalStatus_method_names[1], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_Feed_(LocalStatus_method_names[2], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + , rpcmethod_Hard_(LocalStatus_method_names[3], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel) + {} + +::grpc::Status LocalStatus::Stub::Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::Local::Status::LocalDeviceRes* response) { + return ::grpc::internal::BlockingUnaryCall< ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Device_, context, request, response); +} + +void LocalStatus::Stub::async::Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Device_, context, request, response, std::move(f)); +} + +void LocalStatus::Stub::async::Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Device_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>* LocalStatus::Stub::PrepareAsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::Local::Status::LocalDeviceRes, ::Local::Status::LocalDeviceReq, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Device_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>* LocalStatus::Stub::AsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncDeviceRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status LocalStatus::Stub::Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::Local::Status::LocalMqttRes* response) { + return ::grpc::internal::BlockingUnaryCall< ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Mqtt_, context, request, response); +} + +void LocalStatus::Stub::async::Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Mqtt_, context, request, response, std::move(f)); +} + +void LocalStatus::Stub::async::Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Mqtt_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>* LocalStatus::Stub::PrepareAsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::Local::Status::LocalMqttRes, ::Local::Status::LocalMqttReq, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Mqtt_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>* LocalStatus::Stub::AsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncMqttRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status LocalStatus::Stub::Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::Local::Status::LocalFeedRes* response) { + return ::grpc::internal::BlockingUnaryCall< ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Feed_, context, request, response); +} + +void LocalStatus::Stub::async::Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Feed_, context, request, response, std::move(f)); +} + +void LocalStatus::Stub::async::Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Feed_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>* LocalStatus::Stub::PrepareAsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::Local::Status::LocalFeedRes, ::Local::Status::LocalFeedReq, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Feed_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>* LocalStatus::Stub::AsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncFeedRaw(context, request, cq); + result->StartCall(); + return result; +} + +::grpc::Status LocalStatus::Stub::Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::Local::Status::LocalHardRes* response) { + return ::grpc::internal::BlockingUnaryCall< ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_Hard_, context, request, response); +} + +void LocalStatus::Stub::async::Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, std::function f) { + ::grpc::internal::CallbackUnaryCall< ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Hard_, context, request, response, std::move(f)); +} + +void LocalStatus::Stub::async::Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, ::grpc::ClientUnaryReactor* reactor) { + ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_Hard_, context, request, response, reactor); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>* LocalStatus::Stub::PrepareAsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::Local::Status::LocalHardRes, ::Local::Status::LocalHardReq, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_Hard_, context, request); +} + +::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>* LocalStatus::Stub::AsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + auto* result = + this->PrepareAsyncHardRaw(context, request, cq); + result->StartCall(); + return result; +} + +LocalStatus::Service::Service() { + AddMethod(new ::grpc::internal::RpcServiceMethod( + LocalStatus_method_names[0], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< LocalStatus::Service, ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](LocalStatus::Service* service, + ::grpc::ServerContext* ctx, + const ::Local::Status::LocalDeviceReq* req, + ::Local::Status::LocalDeviceRes* resp) { + return service->Device(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + LocalStatus_method_names[1], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< LocalStatus::Service, ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](LocalStatus::Service* service, + ::grpc::ServerContext* ctx, + const ::Local::Status::LocalMqttReq* req, + ::Local::Status::LocalMqttRes* resp) { + return service->Mqtt(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + LocalStatus_method_names[2], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< LocalStatus::Service, ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](LocalStatus::Service* service, + ::grpc::ServerContext* ctx, + const ::Local::Status::LocalFeedReq* req, + ::Local::Status::LocalFeedRes* resp) { + return service->Feed(ctx, req, resp); + }, this))); + AddMethod(new ::grpc::internal::RpcServiceMethod( + LocalStatus_method_names[3], + ::grpc::internal::RpcMethod::NORMAL_RPC, + new ::grpc::internal::RpcMethodHandler< LocalStatus::Service, ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( + [](LocalStatus::Service* service, + ::grpc::ServerContext* ctx, + const ::Local::Status::LocalHardReq* req, + ::Local::Status::LocalHardRes* resp) { + return service->Hard(ctx, req, resp); + }, this))); +} + +LocalStatus::Service::~Service() { +} + +::grpc::Status LocalStatus::Service::Device(::grpc::ServerContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status LocalStatus::Service::Mqtt(::grpc::ServerContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status LocalStatus::Service::Feed(::grpc::ServerContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status LocalStatus::Service::Hard(::grpc::ServerContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response) { + (void) context; + (void) request; + (void) response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + + +} // namespace Local +} // namespace Status + diff --git a/audofeed-device-backend/rpc/Local.Status.grpc.pb.h b/audofeed-device-backend/rpc/Local.Status.grpc.pb.h new file mode 100644 index 0000000..5e3376c --- /dev/null +++ b/audofeed-device-backend/rpc/Local.Status.grpc.pb.h @@ -0,0 +1,713 @@ +// Generated by the gRPC C++ plugin. +// If you make any local change, they will be lost. +// source: Local.Status.proto +#ifndef GRPC_Local_2eStatus_2eproto__INCLUDED +#define GRPC_Local_2eStatus_2eproto__INCLUDED + +#include "Local.Status.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Local { +namespace Status { + +class LocalStatus final { + public: + static constexpr char const* service_full_name() { + return "Local.Status.LocalStatus"; + } + class StubInterface { + public: + virtual ~StubInterface() {} + virtual ::grpc::Status Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::Local::Status::LocalDeviceRes* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>> AsyncDevice(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>>(AsyncDeviceRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>> PrepareAsyncDevice(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>>(PrepareAsyncDeviceRaw(context, request, cq)); + } + virtual ::grpc::Status Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::Local::Status::LocalMqttRes* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>> AsyncMqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>>(AsyncMqttRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>> PrepareAsyncMqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>>(PrepareAsyncMqttRaw(context, request, cq)); + } + virtual ::grpc::Status Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::Local::Status::LocalFeedRes* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>> AsyncFeed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>>(AsyncFeedRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>> PrepareAsyncFeed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>>(PrepareAsyncFeedRaw(context, request, cq)); + } + virtual ::grpc::Status Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::Local::Status::LocalHardRes* response) = 0; + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>> AsyncHard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>>(AsyncHardRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>> PrepareAsyncHard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>>(PrepareAsyncHardRaw(context, request, cq)); + } + class async_interface { + public: + virtual ~async_interface() {} + virtual void Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, std::function) = 0; + virtual void Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, std::function) = 0; + virtual void Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, std::function) = 0; + virtual void Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + virtual void Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, std::function) = 0; + virtual void Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, ::grpc::ClientUnaryReactor* reactor) = 0; + }; + typedef class async_interface experimental_async_interface; + virtual class async_interface* async() { return nullptr; } + class async_interface* experimental_async() { return async(); } + private: + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>* AsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalDeviceRes>* PrepareAsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>* AsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalMqttRes>* PrepareAsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>* AsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalFeedRes>* PrepareAsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>* AsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< ::Local::Status::LocalHardRes>* PrepareAsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) = 0; + }; + class Stub final : public StubInterface { + public: + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + ::grpc::Status Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::Local::Status::LocalDeviceRes* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>> AsyncDevice(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>>(AsyncDeviceRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>> PrepareAsyncDevice(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>>(PrepareAsyncDeviceRaw(context, request, cq)); + } + ::grpc::Status Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::Local::Status::LocalMqttRes* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>> AsyncMqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>>(AsyncMqttRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>> PrepareAsyncMqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>>(PrepareAsyncMqttRaw(context, request, cq)); + } + ::grpc::Status Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::Local::Status::LocalFeedRes* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>> AsyncFeed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>>(AsyncFeedRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>> PrepareAsyncFeed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>>(PrepareAsyncFeedRaw(context, request, cq)); + } + ::grpc::Status Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::Local::Status::LocalHardRes* response) override; + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>> AsyncHard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>>(AsyncHardRaw(context, request, cq)); + } + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>> PrepareAsyncHard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>>(PrepareAsyncHardRaw(context, request, cq)); + } + class async final : + public StubInterface::async_interface { + public: + void Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, std::function) override; + void Device(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, std::function) override; + void Mqtt(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, std::function) override; + void Feed(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response, ::grpc::ClientUnaryReactor* reactor) override; + void Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, std::function) override; + void Hard(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response, ::grpc::ClientUnaryReactor* reactor) override; + private: + friend class Stub; + explicit async(Stub* stub): stub_(stub) { } + Stub* stub() { return stub_; } + Stub* stub_; + }; + class async* async() override { return &async_stub_; } + + private: + std::shared_ptr< ::grpc::ChannelInterface> channel_; + class async async_stub_{this}; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>* AsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalDeviceRes>* PrepareAsyncDeviceRaw(::grpc::ClientContext* context, const ::Local::Status::LocalDeviceReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>* AsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalMqttRes>* PrepareAsyncMqttRaw(::grpc::ClientContext* context, const ::Local::Status::LocalMqttReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>* AsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalFeedRes>* PrepareAsyncFeedRaw(::grpc::ClientContext* context, const ::Local::Status::LocalFeedReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>* AsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) override; + ::grpc::ClientAsyncResponseReader< ::Local::Status::LocalHardRes>* PrepareAsyncHardRaw(::grpc::ClientContext* context, const ::Local::Status::LocalHardReq& request, ::grpc::CompletionQueue* cq) override; + const ::grpc::internal::RpcMethod rpcmethod_Device_; + const ::grpc::internal::RpcMethod rpcmethod_Mqtt_; + const ::grpc::internal::RpcMethod rpcmethod_Feed_; + const ::grpc::internal::RpcMethod rpcmethod_Hard_; + }; + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + virtual ::grpc::Status Device(::grpc::ServerContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response); + virtual ::grpc::Status Mqtt(::grpc::ServerContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response); + virtual ::grpc::Status Feed(::grpc::ServerContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response); + virtual ::grpc::Status Hard(::grpc::ServerContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response); + }; + template + class WithAsyncMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Device() { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestDevice(::grpc::ServerContext* context, ::Local::Status::LocalDeviceReq* request, ::grpc::ServerAsyncResponseWriter< ::Local::Status::LocalDeviceRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Mqtt() { + ::grpc::Service::MarkMethodAsync(1); + } + ~WithAsyncMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestMqtt(::grpc::ServerContext* context, ::Local::Status::LocalMqttReq* request, ::grpc::ServerAsyncResponseWriter< ::Local::Status::LocalMqttRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Feed() { + ::grpc::Service::MarkMethodAsync(2); + } + ~WithAsyncMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestFeed(::grpc::ServerContext* context, ::Local::Status::LocalFeedReq* request, ::grpc::ServerAsyncResponseWriter< ::Local::Status::LocalFeedRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithAsyncMethod_Hard() { + ::grpc::Service::MarkMethodAsync(3); + } + ~WithAsyncMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestHard(::grpc::ServerContext* context, ::Local::Status::LocalHardReq* request, ::grpc::ServerAsyncResponseWriter< ::Local::Status::LocalHardRes>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_Device > > > AsyncService; + template + class WithCallbackMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Device() { + ::grpc::Service::MarkMethodCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes>( + [this]( + ::grpc::CallbackServerContext* context, const ::Local::Status::LocalDeviceReq* request, ::Local::Status::LocalDeviceRes* response) { return this->Device(context, request, response); }));} + void SetMessageAllocatorFor_Device( + ::grpc::MessageAllocator< ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); + static_cast<::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Device( + ::grpc::CallbackServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Mqtt() { + ::grpc::Service::MarkMethodCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes>( + [this]( + ::grpc::CallbackServerContext* context, const ::Local::Status::LocalMqttReq* request, ::Local::Status::LocalMqttRes* response) { return this->Mqtt(context, request, response); }));} + void SetMessageAllocatorFor_Mqtt( + ::grpc::MessageAllocator< ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); + static_cast<::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Mqtt( + ::grpc::CallbackServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Feed() { + ::grpc::Service::MarkMethodCallback(2, + new ::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes>( + [this]( + ::grpc::CallbackServerContext* context, const ::Local::Status::LocalFeedReq* request, ::Local::Status::LocalFeedRes* response) { return this->Feed(context, request, response); }));} + void SetMessageAllocatorFor_Feed( + ::grpc::MessageAllocator< ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(2); + static_cast<::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Feed( + ::grpc::CallbackServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) { return nullptr; } + }; + template + class WithCallbackMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithCallbackMethod_Hard() { + ::grpc::Service::MarkMethodCallback(3, + new ::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes>( + [this]( + ::grpc::CallbackServerContext* context, const ::Local::Status::LocalHardReq* request, ::Local::Status::LocalHardRes* response) { return this->Hard(context, request, response); }));} + void SetMessageAllocatorFor_Hard( + ::grpc::MessageAllocator< ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes>* allocator) { + ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(3); + static_cast<::grpc::internal::CallbackUnaryHandler< ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes>*>(handler) + ->SetMessageAllocator(allocator); + } + ~WithCallbackMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Hard( + ::grpc::CallbackServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) { return nullptr; } + }; + typedef WithCallbackMethod_Device > > > CallbackService; + typedef CallbackService ExperimentalCallbackService; + template + class WithGenericMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Device() { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Mqtt() { + ::grpc::Service::MarkMethodGeneric(1); + } + ~WithGenericMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Feed() { + ::grpc::Service::MarkMethodGeneric(2); + } + ~WithGenericMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithGenericMethod_Hard() { + ::grpc::Service::MarkMethodGeneric(3); + } + ~WithGenericMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithRawMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Device() { + ::grpc::Service::MarkMethodRaw(0); + } + ~WithRawMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestDevice(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Mqtt() { + ::grpc::Service::MarkMethodRaw(1); + } + ~WithRawMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestMqtt(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Feed() { + ::grpc::Service::MarkMethodRaw(2); + } + ~WithRawMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestFeed(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawMethod_Hard() { + ::grpc::Service::MarkMethodRaw(3); + } + ~WithRawMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestHard(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncUnary(3, context, request, response, new_call_cq, notification_cq, tag); + } + }; + template + class WithRawCallbackMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Device() { + ::grpc::Service::MarkMethodRawCallback(0, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Device(context, request, response); })); + } + ~WithRawCallbackMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Device( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Mqtt() { + ::grpc::Service::MarkMethodRawCallback(1, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Mqtt(context, request, response); })); + } + ~WithRawCallbackMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Mqtt( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Feed() { + ::grpc::Service::MarkMethodRawCallback(2, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Feed(context, request, response); })); + } + ~WithRawCallbackMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Feed( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithRawCallbackMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithRawCallbackMethod_Hard() { + ::grpc::Service::MarkMethodRawCallback(3, + new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( + [this]( + ::grpc::CallbackServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->Hard(context, request, response); })); + } + ~WithRawCallbackMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + virtual ::grpc::ServerUnaryReactor* Hard( + ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) { return nullptr; } + }; + template + class WithStreamedUnaryMethod_Device : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Device() { + ::grpc::Service::MarkMethodStreamed(0, + new ::grpc::internal::StreamedUnaryHandler< + ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::Local::Status::LocalDeviceReq, ::Local::Status::LocalDeviceRes>* streamer) { + return this->StreamedDevice(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Device() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Device(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalDeviceReq* /*request*/, ::Local::Status::LocalDeviceRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedDevice(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::Local::Status::LocalDeviceReq,::Local::Status::LocalDeviceRes>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_Mqtt : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Mqtt() { + ::grpc::Service::MarkMethodStreamed(1, + new ::grpc::internal::StreamedUnaryHandler< + ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::Local::Status::LocalMqttReq, ::Local::Status::LocalMqttRes>* streamer) { + return this->StreamedMqtt(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Mqtt() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Mqtt(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalMqttReq* /*request*/, ::Local::Status::LocalMqttRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedMqtt(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::Local::Status::LocalMqttReq,::Local::Status::LocalMqttRes>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_Feed : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Feed() { + ::grpc::Service::MarkMethodStreamed(2, + new ::grpc::internal::StreamedUnaryHandler< + ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::Local::Status::LocalFeedReq, ::Local::Status::LocalFeedRes>* streamer) { + return this->StreamedFeed(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Feed() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Feed(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalFeedReq* /*request*/, ::Local::Status::LocalFeedRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedFeed(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::Local::Status::LocalFeedReq,::Local::Status::LocalFeedRes>* server_unary_streamer) = 0; + }; + template + class WithStreamedUnaryMethod_Hard : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} + public: + WithStreamedUnaryMethod_Hard() { + ::grpc::Service::MarkMethodStreamed(3, + new ::grpc::internal::StreamedUnaryHandler< + ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes>( + [this](::grpc::ServerContext* context, + ::grpc::ServerUnaryStreamer< + ::Local::Status::LocalHardReq, ::Local::Status::LocalHardRes>* streamer) { + return this->StreamedHard(context, + streamer); + })); + } + ~WithStreamedUnaryMethod_Hard() override { + BaseClassMustBeDerivedFromService(this); + } + // disable regular version of this method + ::grpc::Status Hard(::grpc::ServerContext* /*context*/, const ::Local::Status::LocalHardReq* /*request*/, ::Local::Status::LocalHardRes* /*response*/) override { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + // replace default version of method with streamed unary + virtual ::grpc::Status StreamedHard(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::Local::Status::LocalHardReq,::Local::Status::LocalHardRes>* server_unary_streamer) = 0; + }; + typedef WithStreamedUnaryMethod_Device > > > StreamedUnaryService; + typedef Service SplitStreamedService; + typedef WithStreamedUnaryMethod_Device > > > StreamedService; +}; + +} // namespace Status +} // namespace Local + + +#endif // GRPC_Local_2eStatus_2eproto__INCLUDED diff --git a/audofeed-device-backend/rpc/Local.Status.pb.cc b/audofeed-device-backend/rpc/Local.Status.pb.cc new file mode 100644 index 0000000..405d682 --- /dev/null +++ b/audofeed-device-backend/rpc/Local.Status.pb.cc @@ -0,0 +1,2336 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Local.Status.proto + +#include "Local.Status.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace Local { +namespace Status { +constexpr LocalDeviceReq::LocalDeviceReq( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : device_id_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , soft_version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , heart_time_(uint64_t{0u}) + , status_(false){} +struct LocalDeviceReqDefaultTypeInternal { + constexpr LocalDeviceReqDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalDeviceReqDefaultTypeInternal() {} + union { + LocalDeviceReq _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalDeviceReqDefaultTypeInternal _LocalDeviceReq_default_instance_; +constexpr LocalDeviceRes::LocalDeviceRes( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : device_id_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , soft_version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , result_code_(0u){} +struct LocalDeviceResDefaultTypeInternal { + constexpr LocalDeviceResDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalDeviceResDefaultTypeInternal() {} + union { + LocalDeviceRes _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalDeviceResDefaultTypeInternal _LocalDeviceRes_default_instance_; +constexpr LocalMqttReq::LocalMqttReq( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_(0u) + , delay_(0u) + , last_up_(uint64_t{0u}) + , last_down_(uint64_t{0u}){} +struct LocalMqttReqDefaultTypeInternal { + constexpr LocalMqttReqDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalMqttReqDefaultTypeInternal() {} + union { + LocalMqttReq _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalMqttReqDefaultTypeInternal _LocalMqttReq_default_instance_; +constexpr LocalMqttRes::LocalMqttRes( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : result_code_(0u){} +struct LocalMqttResDefaultTypeInternal { + constexpr LocalMqttResDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalMqttResDefaultTypeInternal() {} + union { + LocalMqttRes _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalMqttResDefaultTypeInternal _LocalMqttRes_default_instance_; +constexpr LocalFeedReq::LocalFeedReq( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : last_feed_time_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , last_feed_weight_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , feed_count_(0u) + , feed_weight_(0u){} +struct LocalFeedReqDefaultTypeInternal { + constexpr LocalFeedReqDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalFeedReqDefaultTypeInternal() {} + union { + LocalFeedReq _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalFeedReqDefaultTypeInternal _LocalFeedReq_default_instance_; +constexpr LocalFeedRes::LocalFeedRes( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : result_code_(0u){} +struct LocalFeedResDefaultTypeInternal { + constexpr LocalFeedResDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalFeedResDefaultTypeInternal() {} + union { + LocalFeedRes _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalFeedResDefaultTypeInternal _LocalFeedRes_default_instance_; +constexpr LocalHardReq::LocalHardReq( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : food_remain_(0u) + , temperature_(0u) + , motor_(false) + , weight_(false) + , door_(false) + , stuck_(false){} +struct LocalHardReqDefaultTypeInternal { + constexpr LocalHardReqDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalHardReqDefaultTypeInternal() {} + union { + LocalHardReq _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalHardReqDefaultTypeInternal _LocalHardReq_default_instance_; +constexpr LocalHardRes::LocalHardRes( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : action_(0u) + , result_code_(0u){} +struct LocalHardResDefaultTypeInternal { + constexpr LocalHardResDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~LocalHardResDefaultTypeInternal() {} + union { + LocalHardRes _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LocalHardResDefaultTypeInternal _LocalHardRes_default_instance_; +} // namespace Status +} // namespace Local +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_Local_2eStatus_2eproto[8]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_Local_2eStatus_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_Local_2eStatus_2eproto = nullptr; + +const uint32_t TableStruct_Local_2eStatus_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceReq, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceReq, status_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceReq, device_id_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceReq, soft_version_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceReq, heart_time_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceRes, device_id_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceRes, soft_version_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalDeviceRes, result_code_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttReq, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttReq, status_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttReq, delay_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttReq, last_up_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttReq, last_down_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalMqttRes, result_code_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedReq, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedReq, feed_count_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedReq, feed_weight_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedReq, last_feed_time_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedReq, last_feed_weight_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalFeedRes, result_code_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, food_remain_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, temperature_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, motor_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, weight_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, door_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardReq, stuck_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardRes, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardRes, action_), + PROTOBUF_FIELD_OFFSET(::Local::Status::LocalHardRes, result_code_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::Local::Status::LocalDeviceReq)}, + { 10, -1, -1, sizeof(::Local::Status::LocalDeviceRes)}, + { 19, -1, -1, sizeof(::Local::Status::LocalMqttReq)}, + { 29, -1, -1, sizeof(::Local::Status::LocalMqttRes)}, + { 36, -1, -1, sizeof(::Local::Status::LocalFeedReq)}, + { 46, -1, -1, sizeof(::Local::Status::LocalFeedRes)}, + { 53, -1, -1, sizeof(::Local::Status::LocalHardReq)}, + { 65, -1, -1, sizeof(::Local::Status::LocalHardRes)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::Local::Status::_LocalDeviceReq_default_instance_), + reinterpret_cast(&::Local::Status::_LocalDeviceRes_default_instance_), + reinterpret_cast(&::Local::Status::_LocalMqttReq_default_instance_), + reinterpret_cast(&::Local::Status::_LocalMqttRes_default_instance_), + reinterpret_cast(&::Local::Status::_LocalFeedReq_default_instance_), + reinterpret_cast(&::Local::Status::_LocalFeedRes_default_instance_), + reinterpret_cast(&::Local::Status::_LocalHardReq_default_instance_), + reinterpret_cast(&::Local::Status::_LocalHardRes_default_instance_), +}; + +const char descriptor_table_protodef_Local_2eStatus_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\022Local.Status.proto\022\014Local.Status\"]\n\016Lo" + "calDeviceReq\022\016\n\006status\030\001 \001(\010\022\021\n\tdevice_i" + "d\030\002 \001(\t\022\024\n\014soft_version\030\003 \001(\t\022\022\n\nheart_t" + "ime\030\004 \001(\004\"N\n\016LocalDeviceRes\022\021\n\tdevice_id" + "\030\001 \001(\t\022\024\n\014soft_version\030\002 \001(\t\022\023\n\013result_c" + "ode\030\003 \001(\r\"Q\n\014LocalMqttReq\022\016\n\006status\030\001 \001(" + "\r\022\r\n\005delay\030\002 \001(\r\022\017\n\007last_up\030\003 \001(\004\022\021\n\tlas" + "t_down\030\004 \001(\004\"#\n\014LocalMqttRes\022\023\n\013result_c" + "ode\030\001 \001(\r\"i\n\014LocalFeedReq\022\022\n\nfeed_count\030" + "\001 \001(\r\022\023\n\013feed_weight\030\002 \001(\r\022\026\n\016last_feed_" + "time\030\003 \001(\t\022\030\n\020last_feed_weight\030\004 \001(\t\"#\n\014" + "LocalFeedRes\022\023\n\013result_code\030\001 \001(\r\"t\n\014Loc" + "alHardReq\022\023\n\013food_remain\030\001 \001(\r\022\023\n\013temper" + "ature\030\002 \001(\r\022\r\n\005motor\030\003 \001(\010\022\016\n\006weight\030\004 \001" + "(\010\022\014\n\004door\030\005 \001(\010\022\r\n\005stuck\030\006 \001(\010\"3\n\014Local" + "HardRes\022\016\n\006action\030\001 \001(\r\022\023\n\013result_code\030\002" + " \001(\r2\233\002\n\013LocalStatus\022F\n\006Device\022\034.Local.S" + "tatus.LocalDeviceReq\032\034.Local.Status.Loca" + "lDeviceRes\"\000\022@\n\004Mqtt\022\032.Local.Status.Loca" + "lMqttReq\032\032.Local.Status.LocalMqttRes\"\000\022@" + "\n\004Feed\022\032.Local.Status.LocalFeedReq\032\032.Loc" + "al.Status.LocalFeedRes\"\000\022@\n\004Hard\022\032.Local" + ".Status.LocalHardReq\032\032.Local.Status.Loca" + "lHardRes\"\000b\006proto3" + ; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_Local_2eStatus_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Local_2eStatus_2eproto = { + false, false, 938, descriptor_table_protodef_Local_2eStatus_2eproto, "Local.Status.proto", + &descriptor_table_Local_2eStatus_2eproto_once, nullptr, 0, 8, + schemas, file_default_instances, TableStruct_Local_2eStatus_2eproto::offsets, + file_level_metadata_Local_2eStatus_2eproto, file_level_enum_descriptors_Local_2eStatus_2eproto, file_level_service_descriptors_Local_2eStatus_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_Local_2eStatus_2eproto_getter() { + return &descriptor_table_Local_2eStatus_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_Local_2eStatus_2eproto(&descriptor_table_Local_2eStatus_2eproto); +namespace Local { +namespace Status { + +// =================================================================== + +class LocalDeviceReq::_Internal { + public: +}; + +LocalDeviceReq::LocalDeviceReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalDeviceReq) +} +LocalDeviceReq::LocalDeviceReq(const LocalDeviceReq& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + device_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_device_id().empty()) { + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_device_id(), + GetArenaForAllocation()); + } + soft_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_soft_version().empty()) { + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_soft_version(), + GetArenaForAllocation()); + } + ::memcpy(&heart_time_, &from.heart_time_, + static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&heart_time_)) + sizeof(status_)); + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalDeviceReq) +} + +inline void LocalDeviceReq::SharedCtor() { +device_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +soft_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&heart_time_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&heart_time_)) + sizeof(status_)); +} + +LocalDeviceReq::~LocalDeviceReq() { + // @@protoc_insertion_point(destructor:Local.Status.LocalDeviceReq) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalDeviceReq::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + device_id_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + soft_version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void LocalDeviceReq::ArenaDtor(void* object) { + LocalDeviceReq* _this = reinterpret_cast< LocalDeviceReq* >(object); + (void)_this; +} +void LocalDeviceReq::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalDeviceReq::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalDeviceReq::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalDeviceReq) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + device_id_.ClearToEmpty(); + soft_version_.ClearToEmpty(); + ::memset(&heart_time_, 0, static_cast( + reinterpret_cast(&status_) - + reinterpret_cast(&heart_time_)) + sizeof(status_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalDeviceReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // bool status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + status_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string device_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_device_id(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalDeviceReq.device_id")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string soft_version = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_soft_version(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalDeviceReq.soft_version")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 heart_time = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + heart_time_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalDeviceReq::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalDeviceReq) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // bool status = 1; + if (this->_internal_status() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_status(), target); + } + + // string device_id = 2; + if (!this->_internal_device_id().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_device_id().data(), static_cast(this->_internal_device_id().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalDeviceReq.device_id"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_device_id(), target); + } + + // string soft_version = 3; + if (!this->_internal_soft_version().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_soft_version().data(), static_cast(this->_internal_soft_version().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalDeviceReq.soft_version"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_soft_version(), target); + } + + // uint64 heart_time = 4; + if (this->_internal_heart_time() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(4, this->_internal_heart_time(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalDeviceReq) + return target; +} + +size_t LocalDeviceReq::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalDeviceReq) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string device_id = 2; + if (!this->_internal_device_id().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_device_id()); + } + + // string soft_version = 3; + if (!this->_internal_soft_version().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_soft_version()); + } + + // uint64 heart_time = 4; + if (this->_internal_heart_time() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_heart_time()); + } + + // bool status = 1; + if (this->_internal_status() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalDeviceReq::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalDeviceReq::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalDeviceReq::GetClassData() const { return &_class_data_; } + +void LocalDeviceReq::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalDeviceReq::MergeFrom(const LocalDeviceReq& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalDeviceReq) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_device_id().empty()) { + _internal_set_device_id(from._internal_device_id()); + } + if (!from._internal_soft_version().empty()) { + _internal_set_soft_version(from._internal_soft_version()); + } + if (from._internal_heart_time() != 0) { + _internal_set_heart_time(from._internal_heart_time()); + } + if (from._internal_status() != 0) { + _internal_set_status(from._internal_status()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalDeviceReq::CopyFrom(const LocalDeviceReq& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalDeviceReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalDeviceReq::IsInitialized() const { + return true; +} + +void LocalDeviceReq::InternalSwap(LocalDeviceReq* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &device_id_, lhs_arena, + &other->device_id_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &soft_version_, lhs_arena, + &other->soft_version_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(LocalDeviceReq, status_) + + sizeof(LocalDeviceReq::status_) + - PROTOBUF_FIELD_OFFSET(LocalDeviceReq, heart_time_)>( + reinterpret_cast(&heart_time_), + reinterpret_cast(&other->heart_time_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalDeviceReq::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[0]); +} + +// =================================================================== + +class LocalDeviceRes::_Internal { + public: +}; + +LocalDeviceRes::LocalDeviceRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalDeviceRes) +} +LocalDeviceRes::LocalDeviceRes(const LocalDeviceRes& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + device_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_device_id().empty()) { + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_device_id(), + GetArenaForAllocation()); + } + soft_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_soft_version().empty()) { + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_soft_version(), + GetArenaForAllocation()); + } + result_code_ = from.result_code_; + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalDeviceRes) +} + +inline void LocalDeviceRes::SharedCtor() { +device_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +soft_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +result_code_ = 0u; +} + +LocalDeviceRes::~LocalDeviceRes() { + // @@protoc_insertion_point(destructor:Local.Status.LocalDeviceRes) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalDeviceRes::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + device_id_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + soft_version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void LocalDeviceRes::ArenaDtor(void* object) { + LocalDeviceRes* _this = reinterpret_cast< LocalDeviceRes* >(object); + (void)_this; +} +void LocalDeviceRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalDeviceRes::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalDeviceRes::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalDeviceRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + device_id_.ClearToEmpty(); + soft_version_.ClearToEmpty(); + result_code_ = 0u; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalDeviceRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string device_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_device_id(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalDeviceRes.device_id")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string soft_version = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_soft_version(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalDeviceRes.soft_version")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 result_code = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + result_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalDeviceRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalDeviceRes) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string device_id = 1; + if (!this->_internal_device_id().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_device_id().data(), static_cast(this->_internal_device_id().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalDeviceRes.device_id"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_device_id(), target); + } + + // string soft_version = 2; + if (!this->_internal_soft_version().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_soft_version().data(), static_cast(this->_internal_soft_version().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalDeviceRes.soft_version"); + target = stream->WriteStringMaybeAliased( + 2, this->_internal_soft_version(), target); + } + + // uint32 result_code = 3; + if (this->_internal_result_code() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_result_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalDeviceRes) + return target; +} + +size_t LocalDeviceRes::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalDeviceRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string device_id = 1; + if (!this->_internal_device_id().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_device_id()); + } + + // string soft_version = 2; + if (!this->_internal_soft_version().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_soft_version()); + } + + // uint32 result_code = 3; + if (this->_internal_result_code() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_result_code()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalDeviceRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalDeviceRes::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalDeviceRes::GetClassData() const { return &_class_data_; } + +void LocalDeviceRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalDeviceRes::MergeFrom(const LocalDeviceRes& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalDeviceRes) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_device_id().empty()) { + _internal_set_device_id(from._internal_device_id()); + } + if (!from._internal_soft_version().empty()) { + _internal_set_soft_version(from._internal_soft_version()); + } + if (from._internal_result_code() != 0) { + _internal_set_result_code(from._internal_result_code()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalDeviceRes::CopyFrom(const LocalDeviceRes& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalDeviceRes) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalDeviceRes::IsInitialized() const { + return true; +} + +void LocalDeviceRes::InternalSwap(LocalDeviceRes* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &device_id_, lhs_arena, + &other->device_id_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &soft_version_, lhs_arena, + &other->soft_version_, rhs_arena + ); + swap(result_code_, other->result_code_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalDeviceRes::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[1]); +} + +// =================================================================== + +class LocalMqttReq::_Internal { + public: +}; + +LocalMqttReq::LocalMqttReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalMqttReq) +} +LocalMqttReq::LocalMqttReq(const LocalMqttReq& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&status_, &from.status_, + static_cast(reinterpret_cast(&last_down_) - + reinterpret_cast(&status_)) + sizeof(last_down_)); + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalMqttReq) +} + +inline void LocalMqttReq::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&status_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&last_down_) - + reinterpret_cast(&status_)) + sizeof(last_down_)); +} + +LocalMqttReq::~LocalMqttReq() { + // @@protoc_insertion_point(destructor:Local.Status.LocalMqttReq) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalMqttReq::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void LocalMqttReq::ArenaDtor(void* object) { + LocalMqttReq* _this = reinterpret_cast< LocalMqttReq* >(object); + (void)_this; +} +void LocalMqttReq::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalMqttReq::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalMqttReq::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalMqttReq) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&status_, 0, static_cast( + reinterpret_cast(&last_down_) - + reinterpret_cast(&status_)) + sizeof(last_down_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalMqttReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + status_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 delay = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + delay_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 last_up = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + last_up_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint64 last_down = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + last_down_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalMqttReq::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalMqttReq) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 status = 1; + if (this->_internal_status() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_status(), target); + } + + // uint32 delay = 2; + if (this->_internal_delay() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_delay(), target); + } + + // uint64 last_up = 3; + if (this->_internal_last_up() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(3, this->_internal_last_up(), target); + } + + // uint64 last_down = 4; + if (this->_internal_last_down() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(4, this->_internal_last_down(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalMqttReq) + return target; +} + +size_t LocalMqttReq::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalMqttReq) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 status = 1; + if (this->_internal_status() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_status()); + } + + // uint32 delay = 2; + if (this->_internal_delay() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_delay()); + } + + // uint64 last_up = 3; + if (this->_internal_last_up() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_last_up()); + } + + // uint64 last_down = 4; + if (this->_internal_last_down() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_last_down()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalMqttReq::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalMqttReq::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalMqttReq::GetClassData() const { return &_class_data_; } + +void LocalMqttReq::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalMqttReq::MergeFrom(const LocalMqttReq& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalMqttReq) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_status() != 0) { + _internal_set_status(from._internal_status()); + } + if (from._internal_delay() != 0) { + _internal_set_delay(from._internal_delay()); + } + if (from._internal_last_up() != 0) { + _internal_set_last_up(from._internal_last_up()); + } + if (from._internal_last_down() != 0) { + _internal_set_last_down(from._internal_last_down()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalMqttReq::CopyFrom(const LocalMqttReq& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalMqttReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalMqttReq::IsInitialized() const { + return true; +} + +void LocalMqttReq::InternalSwap(LocalMqttReq* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(LocalMqttReq, last_down_) + + sizeof(LocalMqttReq::last_down_) + - PROTOBUF_FIELD_OFFSET(LocalMqttReq, status_)>( + reinterpret_cast(&status_), + reinterpret_cast(&other->status_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalMqttReq::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[2]); +} + +// =================================================================== + +class LocalMqttRes::_Internal { + public: +}; + +LocalMqttRes::LocalMqttRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalMqttRes) +} +LocalMqttRes::LocalMqttRes(const LocalMqttRes& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + result_code_ = from.result_code_; + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalMqttRes) +} + +inline void LocalMqttRes::SharedCtor() { +result_code_ = 0u; +} + +LocalMqttRes::~LocalMqttRes() { + // @@protoc_insertion_point(destructor:Local.Status.LocalMqttRes) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalMqttRes::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void LocalMqttRes::ArenaDtor(void* object) { + LocalMqttRes* _this = reinterpret_cast< LocalMqttRes* >(object); + (void)_this; +} +void LocalMqttRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalMqttRes::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalMqttRes::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalMqttRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + result_code_ = 0u; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalMqttRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 result_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + result_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalMqttRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalMqttRes) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 result_code = 1; + if (this->_internal_result_code() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_result_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalMqttRes) + return target; +} + +size_t LocalMqttRes::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalMqttRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 result_code = 1; + if (this->_internal_result_code() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_result_code()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalMqttRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalMqttRes::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalMqttRes::GetClassData() const { return &_class_data_; } + +void LocalMqttRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalMqttRes::MergeFrom(const LocalMqttRes& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalMqttRes) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_result_code() != 0) { + _internal_set_result_code(from._internal_result_code()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalMqttRes::CopyFrom(const LocalMqttRes& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalMqttRes) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalMqttRes::IsInitialized() const { + return true; +} + +void LocalMqttRes::InternalSwap(LocalMqttRes* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(result_code_, other->result_code_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalMqttRes::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[3]); +} + +// =================================================================== + +class LocalFeedReq::_Internal { + public: +}; + +LocalFeedReq::LocalFeedReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalFeedReq) +} +LocalFeedReq::LocalFeedReq(const LocalFeedReq& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + last_feed_time_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + last_feed_time_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_last_feed_time().empty()) { + last_feed_time_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_last_feed_time(), + GetArenaForAllocation()); + } + last_feed_weight_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + last_feed_weight_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_last_feed_weight().empty()) { + last_feed_weight_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_last_feed_weight(), + GetArenaForAllocation()); + } + ::memcpy(&feed_count_, &from.feed_count_, + static_cast(reinterpret_cast(&feed_weight_) - + reinterpret_cast(&feed_count_)) + sizeof(feed_weight_)); + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalFeedReq) +} + +inline void LocalFeedReq::SharedCtor() { +last_feed_time_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + last_feed_time_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +last_feed_weight_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + last_feed_weight_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&feed_count_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&feed_weight_) - + reinterpret_cast(&feed_count_)) + sizeof(feed_weight_)); +} + +LocalFeedReq::~LocalFeedReq() { + // @@protoc_insertion_point(destructor:Local.Status.LocalFeedReq) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalFeedReq::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + last_feed_time_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + last_feed_weight_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void LocalFeedReq::ArenaDtor(void* object) { + LocalFeedReq* _this = reinterpret_cast< LocalFeedReq* >(object); + (void)_this; +} +void LocalFeedReq::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalFeedReq::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalFeedReq::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalFeedReq) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + last_feed_time_.ClearToEmpty(); + last_feed_weight_.ClearToEmpty(); + ::memset(&feed_count_, 0, static_cast( + reinterpret_cast(&feed_weight_) - + reinterpret_cast(&feed_count_)) + sizeof(feed_weight_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalFeedReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 feed_count = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + feed_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 feed_weight = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + feed_weight_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string last_feed_time = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_last_feed_time(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalFeedReq.last_feed_time")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // string last_feed_weight = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + auto str = _internal_mutable_last_feed_weight(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "Local.Status.LocalFeedReq.last_feed_weight")); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalFeedReq::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalFeedReq) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 feed_count = 1; + if (this->_internal_feed_count() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_feed_count(), target); + } + + // uint32 feed_weight = 2; + if (this->_internal_feed_weight() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_feed_weight(), target); + } + + // string last_feed_time = 3; + if (!this->_internal_last_feed_time().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_last_feed_time().data(), static_cast(this->_internal_last_feed_time().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalFeedReq.last_feed_time"); + target = stream->WriteStringMaybeAliased( + 3, this->_internal_last_feed_time(), target); + } + + // string last_feed_weight = 4; + if (!this->_internal_last_feed_weight().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_last_feed_weight().data(), static_cast(this->_internal_last_feed_weight().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Local.Status.LocalFeedReq.last_feed_weight"); + target = stream->WriteStringMaybeAliased( + 4, this->_internal_last_feed_weight(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalFeedReq) + return target; +} + +size_t LocalFeedReq::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalFeedReq) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string last_feed_time = 3; + if (!this->_internal_last_feed_time().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_last_feed_time()); + } + + // string last_feed_weight = 4; + if (!this->_internal_last_feed_weight().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_last_feed_weight()); + } + + // uint32 feed_count = 1; + if (this->_internal_feed_count() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_feed_count()); + } + + // uint32 feed_weight = 2; + if (this->_internal_feed_weight() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_feed_weight()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalFeedReq::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalFeedReq::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalFeedReq::GetClassData() const { return &_class_data_; } + +void LocalFeedReq::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalFeedReq::MergeFrom(const LocalFeedReq& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalFeedReq) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_last_feed_time().empty()) { + _internal_set_last_feed_time(from._internal_last_feed_time()); + } + if (!from._internal_last_feed_weight().empty()) { + _internal_set_last_feed_weight(from._internal_last_feed_weight()); + } + if (from._internal_feed_count() != 0) { + _internal_set_feed_count(from._internal_feed_count()); + } + if (from._internal_feed_weight() != 0) { + _internal_set_feed_weight(from._internal_feed_weight()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalFeedReq::CopyFrom(const LocalFeedReq& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalFeedReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalFeedReq::IsInitialized() const { + return true; +} + +void LocalFeedReq::InternalSwap(LocalFeedReq* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &last_feed_time_, lhs_arena, + &other->last_feed_time_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &last_feed_weight_, lhs_arena, + &other->last_feed_weight_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(LocalFeedReq, feed_weight_) + + sizeof(LocalFeedReq::feed_weight_) + - PROTOBUF_FIELD_OFFSET(LocalFeedReq, feed_count_)>( + reinterpret_cast(&feed_count_), + reinterpret_cast(&other->feed_count_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalFeedReq::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[4]); +} + +// =================================================================== + +class LocalFeedRes::_Internal { + public: +}; + +LocalFeedRes::LocalFeedRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalFeedRes) +} +LocalFeedRes::LocalFeedRes(const LocalFeedRes& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + result_code_ = from.result_code_; + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalFeedRes) +} + +inline void LocalFeedRes::SharedCtor() { +result_code_ = 0u; +} + +LocalFeedRes::~LocalFeedRes() { + // @@protoc_insertion_point(destructor:Local.Status.LocalFeedRes) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalFeedRes::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void LocalFeedRes::ArenaDtor(void* object) { + LocalFeedRes* _this = reinterpret_cast< LocalFeedRes* >(object); + (void)_this; +} +void LocalFeedRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalFeedRes::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalFeedRes::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalFeedRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + result_code_ = 0u; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalFeedRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 result_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + result_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalFeedRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalFeedRes) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 result_code = 1; + if (this->_internal_result_code() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_result_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalFeedRes) + return target; +} + +size_t LocalFeedRes::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalFeedRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 result_code = 1; + if (this->_internal_result_code() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_result_code()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalFeedRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalFeedRes::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalFeedRes::GetClassData() const { return &_class_data_; } + +void LocalFeedRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalFeedRes::MergeFrom(const LocalFeedRes& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalFeedRes) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_result_code() != 0) { + _internal_set_result_code(from._internal_result_code()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalFeedRes::CopyFrom(const LocalFeedRes& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalFeedRes) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalFeedRes::IsInitialized() const { + return true; +} + +void LocalFeedRes::InternalSwap(LocalFeedRes* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(result_code_, other->result_code_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalFeedRes::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[5]); +} + +// =================================================================== + +class LocalHardReq::_Internal { + public: +}; + +LocalHardReq::LocalHardReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalHardReq) +} +LocalHardReq::LocalHardReq(const LocalHardReq& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&food_remain_, &from.food_remain_, + static_cast(reinterpret_cast(&stuck_) - + reinterpret_cast(&food_remain_)) + sizeof(stuck_)); + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalHardReq) +} + +inline void LocalHardReq::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&food_remain_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&stuck_) - + reinterpret_cast(&food_remain_)) + sizeof(stuck_)); +} + +LocalHardReq::~LocalHardReq() { + // @@protoc_insertion_point(destructor:Local.Status.LocalHardReq) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalHardReq::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void LocalHardReq::ArenaDtor(void* object) { + LocalHardReq* _this = reinterpret_cast< LocalHardReq* >(object); + (void)_this; +} +void LocalHardReq::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalHardReq::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalHardReq::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalHardReq) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&food_remain_, 0, static_cast( + reinterpret_cast(&stuck_) - + reinterpret_cast(&food_remain_)) + sizeof(stuck_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalHardReq::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 food_remain = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + food_remain_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 temperature = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + temperature_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool motor = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + motor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool weight = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + weight_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool door = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + door_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // bool stuck = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + stuck_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalHardReq::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalHardReq) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 food_remain = 1; + if (this->_internal_food_remain() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_food_remain(), target); + } + + // uint32 temperature = 2; + if (this->_internal_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_temperature(), target); + } + + // bool motor = 3; + if (this->_internal_motor() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_motor(), target); + } + + // bool weight = 4; + if (this->_internal_weight() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_weight(), target); + } + + // bool door = 5; + if (this->_internal_door() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_door(), target); + } + + // bool stuck = 6; + if (this->_internal_stuck() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_stuck(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalHardReq) + return target; +} + +size_t LocalHardReq::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalHardReq) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 food_remain = 1; + if (this->_internal_food_remain() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_food_remain()); + } + + // uint32 temperature = 2; + if (this->_internal_temperature() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_temperature()); + } + + // bool motor = 3; + if (this->_internal_motor() != 0) { + total_size += 1 + 1; + } + + // bool weight = 4; + if (this->_internal_weight() != 0) { + total_size += 1 + 1; + } + + // bool door = 5; + if (this->_internal_door() != 0) { + total_size += 1 + 1; + } + + // bool stuck = 6; + if (this->_internal_stuck() != 0) { + total_size += 1 + 1; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalHardReq::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalHardReq::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalHardReq::GetClassData() const { return &_class_data_; } + +void LocalHardReq::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalHardReq::MergeFrom(const LocalHardReq& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalHardReq) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_food_remain() != 0) { + _internal_set_food_remain(from._internal_food_remain()); + } + if (from._internal_temperature() != 0) { + _internal_set_temperature(from._internal_temperature()); + } + if (from._internal_motor() != 0) { + _internal_set_motor(from._internal_motor()); + } + if (from._internal_weight() != 0) { + _internal_set_weight(from._internal_weight()); + } + if (from._internal_door() != 0) { + _internal_set_door(from._internal_door()); + } + if (from._internal_stuck() != 0) { + _internal_set_stuck(from._internal_stuck()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalHardReq::CopyFrom(const LocalHardReq& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalHardReq) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalHardReq::IsInitialized() const { + return true; +} + +void LocalHardReq::InternalSwap(LocalHardReq* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(LocalHardReq, stuck_) + + sizeof(LocalHardReq::stuck_) + - PROTOBUF_FIELD_OFFSET(LocalHardReq, food_remain_)>( + reinterpret_cast(&food_remain_), + reinterpret_cast(&other->food_remain_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalHardReq::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[6]); +} + +// =================================================================== + +class LocalHardRes::_Internal { + public: +}; + +LocalHardRes::LocalHardRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:Local.Status.LocalHardRes) +} +LocalHardRes::LocalHardRes(const LocalHardRes& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&action_, &from.action_, + static_cast(reinterpret_cast(&result_code_) - + reinterpret_cast(&action_)) + sizeof(result_code_)); + // @@protoc_insertion_point(copy_constructor:Local.Status.LocalHardRes) +} + +inline void LocalHardRes::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&action_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&result_code_) - + reinterpret_cast(&action_)) + sizeof(result_code_)); +} + +LocalHardRes::~LocalHardRes() { + // @@protoc_insertion_point(destructor:Local.Status.LocalHardRes) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +inline void LocalHardRes::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void LocalHardRes::ArenaDtor(void* object) { + LocalHardRes* _this = reinterpret_cast< LocalHardRes* >(object); + (void)_this; +} +void LocalHardRes::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void LocalHardRes::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void LocalHardRes::Clear() { +// @@protoc_insertion_point(message_clear_start:Local.Status.LocalHardRes) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&action_, 0, static_cast( + reinterpret_cast(&result_code_) - + reinterpret_cast(&action_)) + sizeof(result_code_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* LocalHardRes::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // uint32 action = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + action_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // uint32 result_code = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + result_code_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* LocalHardRes::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Local.Status.LocalHardRes) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // uint32 action = 1; + if (this->_internal_action() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_action(), target); + } + + // uint32 result_code = 2; + if (this->_internal_result_code() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_result_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Local.Status.LocalHardRes) + return target; +} + +size_t LocalHardRes::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Local.Status.LocalHardRes) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint32 action = 1; + if (this->_internal_action() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_action()); + } + + // uint32 result_code = 2; + if (this->_internal_result_code() != 0) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_result_code()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LocalHardRes::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, + LocalHardRes::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LocalHardRes::GetClassData() const { return &_class_data_; } + +void LocalHardRes::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { + static_cast(to)->MergeFrom( + static_cast(from)); +} + + +void LocalHardRes::MergeFrom(const LocalHardRes& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:Local.Status.LocalHardRes) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_action() != 0) { + _internal_set_action(from._internal_action()); + } + if (from._internal_result_code() != 0) { + _internal_set_result_code(from._internal_result_code()); + } + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void LocalHardRes::CopyFrom(const LocalHardRes& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Local.Status.LocalHardRes) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool LocalHardRes::IsInitialized() const { + return true; +} + +void LocalHardRes::InternalSwap(LocalHardRes* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(LocalHardRes, result_code_) + + sizeof(LocalHardRes::result_code_) + - PROTOBUF_FIELD_OFFSET(LocalHardRes, action_)>( + reinterpret_cast(&action_), + reinterpret_cast(&other->action_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata LocalHardRes::GetMetadata() const { + return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( + &descriptor_table_Local_2eStatus_2eproto_getter, &descriptor_table_Local_2eStatus_2eproto_once, + file_level_metadata_Local_2eStatus_2eproto[7]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace Status +} // namespace Local +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::Local::Status::LocalDeviceReq* Arena::CreateMaybeMessage< ::Local::Status::LocalDeviceReq >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalDeviceReq >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalDeviceRes* Arena::CreateMaybeMessage< ::Local::Status::LocalDeviceRes >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalDeviceRes >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalMqttReq* Arena::CreateMaybeMessage< ::Local::Status::LocalMqttReq >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalMqttReq >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalMqttRes* Arena::CreateMaybeMessage< ::Local::Status::LocalMqttRes >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalMqttRes >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalFeedReq* Arena::CreateMaybeMessage< ::Local::Status::LocalFeedReq >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalFeedReq >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalFeedRes* Arena::CreateMaybeMessage< ::Local::Status::LocalFeedRes >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalFeedRes >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalHardReq* Arena::CreateMaybeMessage< ::Local::Status::LocalHardReq >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalHardReq >(arena); +} +template<> PROTOBUF_NOINLINE ::Local::Status::LocalHardRes* Arena::CreateMaybeMessage< ::Local::Status::LocalHardRes >(Arena* arena) { + return Arena::CreateMessageInternal< ::Local::Status::LocalHardRes >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/audofeed-device-backend/rpc/Local.Status.pb.h b/audofeed-device-backend/rpc/Local.Status.pb.h new file mode 100644 index 0000000..83b0b5c --- /dev/null +++ b/audofeed-device-backend/rpc/Local.Status.pb.h @@ -0,0 +1,2233 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Local.Status.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_Local_2eStatus_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_Local_2eStatus_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_Local_2eStatus_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_Local_2eStatus_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[8] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_Local_2eStatus_2eproto; +namespace Local { +namespace Status { +class LocalDeviceReq; +struct LocalDeviceReqDefaultTypeInternal; +extern LocalDeviceReqDefaultTypeInternal _LocalDeviceReq_default_instance_; +class LocalDeviceRes; +struct LocalDeviceResDefaultTypeInternal; +extern LocalDeviceResDefaultTypeInternal _LocalDeviceRes_default_instance_; +class LocalFeedReq; +struct LocalFeedReqDefaultTypeInternal; +extern LocalFeedReqDefaultTypeInternal _LocalFeedReq_default_instance_; +class LocalFeedRes; +struct LocalFeedResDefaultTypeInternal; +extern LocalFeedResDefaultTypeInternal _LocalFeedRes_default_instance_; +class LocalHardReq; +struct LocalHardReqDefaultTypeInternal; +extern LocalHardReqDefaultTypeInternal _LocalHardReq_default_instance_; +class LocalHardRes; +struct LocalHardResDefaultTypeInternal; +extern LocalHardResDefaultTypeInternal _LocalHardRes_default_instance_; +class LocalMqttReq; +struct LocalMqttReqDefaultTypeInternal; +extern LocalMqttReqDefaultTypeInternal _LocalMqttReq_default_instance_; +class LocalMqttRes; +struct LocalMqttResDefaultTypeInternal; +extern LocalMqttResDefaultTypeInternal _LocalMqttRes_default_instance_; +} // namespace Status +} // namespace Local +PROTOBUF_NAMESPACE_OPEN +template<> ::Local::Status::LocalDeviceReq* Arena::CreateMaybeMessage<::Local::Status::LocalDeviceReq>(Arena*); +template<> ::Local::Status::LocalDeviceRes* Arena::CreateMaybeMessage<::Local::Status::LocalDeviceRes>(Arena*); +template<> ::Local::Status::LocalFeedReq* Arena::CreateMaybeMessage<::Local::Status::LocalFeedReq>(Arena*); +template<> ::Local::Status::LocalFeedRes* Arena::CreateMaybeMessage<::Local::Status::LocalFeedRes>(Arena*); +template<> ::Local::Status::LocalHardReq* Arena::CreateMaybeMessage<::Local::Status::LocalHardReq>(Arena*); +template<> ::Local::Status::LocalHardRes* Arena::CreateMaybeMessage<::Local::Status::LocalHardRes>(Arena*); +template<> ::Local::Status::LocalMqttReq* Arena::CreateMaybeMessage<::Local::Status::LocalMqttReq>(Arena*); +template<> ::Local::Status::LocalMqttRes* Arena::CreateMaybeMessage<::Local::Status::LocalMqttRes>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace Local { +namespace Status { + +// =================================================================== + +class LocalDeviceReq final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalDeviceReq) */ { + public: + inline LocalDeviceReq() : LocalDeviceReq(nullptr) {} + ~LocalDeviceReq() override; + explicit constexpr LocalDeviceReq(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalDeviceReq(const LocalDeviceReq& from); + LocalDeviceReq(LocalDeviceReq&& from) noexcept + : LocalDeviceReq() { + *this = ::std::move(from); + } + + inline LocalDeviceReq& operator=(const LocalDeviceReq& from) { + CopyFrom(from); + return *this; + } + inline LocalDeviceReq& operator=(LocalDeviceReq&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalDeviceReq& default_instance() { + return *internal_default_instance(); + } + static inline const LocalDeviceReq* internal_default_instance() { + return reinterpret_cast( + &_LocalDeviceReq_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(LocalDeviceReq& a, LocalDeviceReq& b) { + a.Swap(&b); + } + inline void Swap(LocalDeviceReq* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalDeviceReq* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalDeviceReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalDeviceReq& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalDeviceReq& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalDeviceReq* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalDeviceReq"; + } + protected: + explicit LocalDeviceReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceIdFieldNumber = 2, + kSoftVersionFieldNumber = 3, + kHeartTimeFieldNumber = 4, + kStatusFieldNumber = 1, + }; + // string device_id = 2; + void clear_device_id(); + const std::string& device_id() const; + template + void set_device_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_device_id(); + PROTOBUF_NODISCARD std::string* release_device_id(); + void set_allocated_device_id(std::string* device_id); + private: + const std::string& _internal_device_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device_id(const std::string& value); + std::string* _internal_mutable_device_id(); + public: + + // string soft_version = 3; + void clear_soft_version(); + const std::string& soft_version() const; + template + void set_soft_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_soft_version(); + PROTOBUF_NODISCARD std::string* release_soft_version(); + void set_allocated_soft_version(std::string* soft_version); + private: + const std::string& _internal_soft_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_soft_version(const std::string& value); + std::string* _internal_mutable_soft_version(); + public: + + // uint64 heart_time = 4; + void clear_heart_time(); + uint64_t heart_time() const; + void set_heart_time(uint64_t value); + private: + uint64_t _internal_heart_time() const; + void _internal_set_heart_time(uint64_t value); + public: + + // bool status = 1; + void clear_status(); + bool status() const; + void set_status(bool value); + private: + bool _internal_status() const; + void _internal_set_status(bool value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalDeviceReq) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr device_id_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr soft_version_; + uint64_t heart_time_; + bool status_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalDeviceRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalDeviceRes) */ { + public: + inline LocalDeviceRes() : LocalDeviceRes(nullptr) {} + ~LocalDeviceRes() override; + explicit constexpr LocalDeviceRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalDeviceRes(const LocalDeviceRes& from); + LocalDeviceRes(LocalDeviceRes&& from) noexcept + : LocalDeviceRes() { + *this = ::std::move(from); + } + + inline LocalDeviceRes& operator=(const LocalDeviceRes& from) { + CopyFrom(from); + return *this; + } + inline LocalDeviceRes& operator=(LocalDeviceRes&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalDeviceRes& default_instance() { + return *internal_default_instance(); + } + static inline const LocalDeviceRes* internal_default_instance() { + return reinterpret_cast( + &_LocalDeviceRes_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(LocalDeviceRes& a, LocalDeviceRes& b) { + a.Swap(&b); + } + inline void Swap(LocalDeviceRes* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalDeviceRes* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalDeviceRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalDeviceRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalDeviceRes& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalDeviceRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalDeviceRes"; + } + protected: + explicit LocalDeviceRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceIdFieldNumber = 1, + kSoftVersionFieldNumber = 2, + kResultCodeFieldNumber = 3, + }; + // string device_id = 1; + void clear_device_id(); + const std::string& device_id() const; + template + void set_device_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_device_id(); + PROTOBUF_NODISCARD std::string* release_device_id(); + void set_allocated_device_id(std::string* device_id); + private: + const std::string& _internal_device_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device_id(const std::string& value); + std::string* _internal_mutable_device_id(); + public: + + // string soft_version = 2; + void clear_soft_version(); + const std::string& soft_version() const; + template + void set_soft_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_soft_version(); + PROTOBUF_NODISCARD std::string* release_soft_version(); + void set_allocated_soft_version(std::string* soft_version); + private: + const std::string& _internal_soft_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_soft_version(const std::string& value); + std::string* _internal_mutable_soft_version(); + public: + + // uint32 result_code = 3; + void clear_result_code(); + uint32_t result_code() const; + void set_result_code(uint32_t value); + private: + uint32_t _internal_result_code() const; + void _internal_set_result_code(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalDeviceRes) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr device_id_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr soft_version_; + uint32_t result_code_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalMqttReq final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalMqttReq) */ { + public: + inline LocalMqttReq() : LocalMqttReq(nullptr) {} + ~LocalMqttReq() override; + explicit constexpr LocalMqttReq(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalMqttReq(const LocalMqttReq& from); + LocalMqttReq(LocalMqttReq&& from) noexcept + : LocalMqttReq() { + *this = ::std::move(from); + } + + inline LocalMqttReq& operator=(const LocalMqttReq& from) { + CopyFrom(from); + return *this; + } + inline LocalMqttReq& operator=(LocalMqttReq&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalMqttReq& default_instance() { + return *internal_default_instance(); + } + static inline const LocalMqttReq* internal_default_instance() { + return reinterpret_cast( + &_LocalMqttReq_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(LocalMqttReq& a, LocalMqttReq& b) { + a.Swap(&b); + } + inline void Swap(LocalMqttReq* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalMqttReq* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalMqttReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalMqttReq& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalMqttReq& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalMqttReq* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalMqttReq"; + } + protected: + explicit LocalMqttReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + kDelayFieldNumber = 2, + kLastUpFieldNumber = 3, + kLastDownFieldNumber = 4, + }; + // uint32 status = 1; + void clear_status(); + uint32_t status() const; + void set_status(uint32_t value); + private: + uint32_t _internal_status() const; + void _internal_set_status(uint32_t value); + public: + + // uint32 delay = 2; + void clear_delay(); + uint32_t delay() const; + void set_delay(uint32_t value); + private: + uint32_t _internal_delay() const; + void _internal_set_delay(uint32_t value); + public: + + // uint64 last_up = 3; + void clear_last_up(); + uint64_t last_up() const; + void set_last_up(uint64_t value); + private: + uint64_t _internal_last_up() const; + void _internal_set_last_up(uint64_t value); + public: + + // uint64 last_down = 4; + void clear_last_down(); + uint64_t last_down() const; + void set_last_down(uint64_t value); + private: + uint64_t _internal_last_down() const; + void _internal_set_last_down(uint64_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalMqttReq) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + uint32_t status_; + uint32_t delay_; + uint64_t last_up_; + uint64_t last_down_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalMqttRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalMqttRes) */ { + public: + inline LocalMqttRes() : LocalMqttRes(nullptr) {} + ~LocalMqttRes() override; + explicit constexpr LocalMqttRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalMqttRes(const LocalMqttRes& from); + LocalMqttRes(LocalMqttRes&& from) noexcept + : LocalMqttRes() { + *this = ::std::move(from); + } + + inline LocalMqttRes& operator=(const LocalMqttRes& from) { + CopyFrom(from); + return *this; + } + inline LocalMqttRes& operator=(LocalMqttRes&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalMqttRes& default_instance() { + return *internal_default_instance(); + } + static inline const LocalMqttRes* internal_default_instance() { + return reinterpret_cast( + &_LocalMqttRes_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(LocalMqttRes& a, LocalMqttRes& b) { + a.Swap(&b); + } + inline void Swap(LocalMqttRes* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalMqttRes* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalMqttRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalMqttRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalMqttRes& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalMqttRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalMqttRes"; + } + protected: + explicit LocalMqttRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kResultCodeFieldNumber = 1, + }; + // uint32 result_code = 1; + void clear_result_code(); + uint32_t result_code() const; + void set_result_code(uint32_t value); + private: + uint32_t _internal_result_code() const; + void _internal_set_result_code(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalMqttRes) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + uint32_t result_code_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalFeedReq final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalFeedReq) */ { + public: + inline LocalFeedReq() : LocalFeedReq(nullptr) {} + ~LocalFeedReq() override; + explicit constexpr LocalFeedReq(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalFeedReq(const LocalFeedReq& from); + LocalFeedReq(LocalFeedReq&& from) noexcept + : LocalFeedReq() { + *this = ::std::move(from); + } + + inline LocalFeedReq& operator=(const LocalFeedReq& from) { + CopyFrom(from); + return *this; + } + inline LocalFeedReq& operator=(LocalFeedReq&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalFeedReq& default_instance() { + return *internal_default_instance(); + } + static inline const LocalFeedReq* internal_default_instance() { + return reinterpret_cast( + &_LocalFeedReq_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(LocalFeedReq& a, LocalFeedReq& b) { + a.Swap(&b); + } + inline void Swap(LocalFeedReq* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalFeedReq* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalFeedReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalFeedReq& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalFeedReq& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalFeedReq* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalFeedReq"; + } + protected: + explicit LocalFeedReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kLastFeedTimeFieldNumber = 3, + kLastFeedWeightFieldNumber = 4, + kFeedCountFieldNumber = 1, + kFeedWeightFieldNumber = 2, + }; + // string last_feed_time = 3; + void clear_last_feed_time(); + const std::string& last_feed_time() const; + template + void set_last_feed_time(ArgT0&& arg0, ArgT... args); + std::string* mutable_last_feed_time(); + PROTOBUF_NODISCARD std::string* release_last_feed_time(); + void set_allocated_last_feed_time(std::string* last_feed_time); + private: + const std::string& _internal_last_feed_time() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_last_feed_time(const std::string& value); + std::string* _internal_mutable_last_feed_time(); + public: + + // string last_feed_weight = 4; + void clear_last_feed_weight(); + const std::string& last_feed_weight() const; + template + void set_last_feed_weight(ArgT0&& arg0, ArgT... args); + std::string* mutable_last_feed_weight(); + PROTOBUF_NODISCARD std::string* release_last_feed_weight(); + void set_allocated_last_feed_weight(std::string* last_feed_weight); + private: + const std::string& _internal_last_feed_weight() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_last_feed_weight(const std::string& value); + std::string* _internal_mutable_last_feed_weight(); + public: + + // uint32 feed_count = 1; + void clear_feed_count(); + uint32_t feed_count() const; + void set_feed_count(uint32_t value); + private: + uint32_t _internal_feed_count() const; + void _internal_set_feed_count(uint32_t value); + public: + + // uint32 feed_weight = 2; + void clear_feed_weight(); + uint32_t feed_weight() const; + void set_feed_weight(uint32_t value); + private: + uint32_t _internal_feed_weight() const; + void _internal_set_feed_weight(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalFeedReq) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr last_feed_time_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr last_feed_weight_; + uint32_t feed_count_; + uint32_t feed_weight_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalFeedRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalFeedRes) */ { + public: + inline LocalFeedRes() : LocalFeedRes(nullptr) {} + ~LocalFeedRes() override; + explicit constexpr LocalFeedRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalFeedRes(const LocalFeedRes& from); + LocalFeedRes(LocalFeedRes&& from) noexcept + : LocalFeedRes() { + *this = ::std::move(from); + } + + inline LocalFeedRes& operator=(const LocalFeedRes& from) { + CopyFrom(from); + return *this; + } + inline LocalFeedRes& operator=(LocalFeedRes&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalFeedRes& default_instance() { + return *internal_default_instance(); + } + static inline const LocalFeedRes* internal_default_instance() { + return reinterpret_cast( + &_LocalFeedRes_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(LocalFeedRes& a, LocalFeedRes& b) { + a.Swap(&b); + } + inline void Swap(LocalFeedRes* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalFeedRes* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalFeedRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalFeedRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalFeedRes& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalFeedRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalFeedRes"; + } + protected: + explicit LocalFeedRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kResultCodeFieldNumber = 1, + }; + // uint32 result_code = 1; + void clear_result_code(); + uint32_t result_code() const; + void set_result_code(uint32_t value); + private: + uint32_t _internal_result_code() const; + void _internal_set_result_code(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalFeedRes) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + uint32_t result_code_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalHardReq final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalHardReq) */ { + public: + inline LocalHardReq() : LocalHardReq(nullptr) {} + ~LocalHardReq() override; + explicit constexpr LocalHardReq(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalHardReq(const LocalHardReq& from); + LocalHardReq(LocalHardReq&& from) noexcept + : LocalHardReq() { + *this = ::std::move(from); + } + + inline LocalHardReq& operator=(const LocalHardReq& from) { + CopyFrom(from); + return *this; + } + inline LocalHardReq& operator=(LocalHardReq&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalHardReq& default_instance() { + return *internal_default_instance(); + } + static inline const LocalHardReq* internal_default_instance() { + return reinterpret_cast( + &_LocalHardReq_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(LocalHardReq& a, LocalHardReq& b) { + a.Swap(&b); + } + inline void Swap(LocalHardReq* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalHardReq* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalHardReq* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalHardReq& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalHardReq& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalHardReq* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalHardReq"; + } + protected: + explicit LocalHardReq(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFoodRemainFieldNumber = 1, + kTemperatureFieldNumber = 2, + kMotorFieldNumber = 3, + kWeightFieldNumber = 4, + kDoorFieldNumber = 5, + kStuckFieldNumber = 6, + }; + // uint32 food_remain = 1; + void clear_food_remain(); + uint32_t food_remain() const; + void set_food_remain(uint32_t value); + private: + uint32_t _internal_food_remain() const; + void _internal_set_food_remain(uint32_t value); + public: + + // uint32 temperature = 2; + void clear_temperature(); + uint32_t temperature() const; + void set_temperature(uint32_t value); + private: + uint32_t _internal_temperature() const; + void _internal_set_temperature(uint32_t value); + public: + + // bool motor = 3; + void clear_motor(); + bool motor() const; + void set_motor(bool value); + private: + bool _internal_motor() const; + void _internal_set_motor(bool value); + public: + + // bool weight = 4; + void clear_weight(); + bool weight() const; + void set_weight(bool value); + private: + bool _internal_weight() const; + void _internal_set_weight(bool value); + public: + + // bool door = 5; + void clear_door(); + bool door() const; + void set_door(bool value); + private: + bool _internal_door() const; + void _internal_set_door(bool value); + public: + + // bool stuck = 6; + void clear_stuck(); + bool stuck() const; + void set_stuck(bool value); + private: + bool _internal_stuck() const; + void _internal_set_stuck(bool value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalHardReq) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + uint32_t food_remain_; + uint32_t temperature_; + bool motor_; + bool weight_; + bool door_; + bool stuck_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// ------------------------------------------------------------------- + +class LocalHardRes final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Local.Status.LocalHardRes) */ { + public: + inline LocalHardRes() : LocalHardRes(nullptr) {} + ~LocalHardRes() override; + explicit constexpr LocalHardRes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + LocalHardRes(const LocalHardRes& from); + LocalHardRes(LocalHardRes&& from) noexcept + : LocalHardRes() { + *this = ::std::move(from); + } + + inline LocalHardRes& operator=(const LocalHardRes& from) { + CopyFrom(from); + return *this; + } + inline LocalHardRes& operator=(LocalHardRes&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const LocalHardRes& default_instance() { + return *internal_default_instance(); + } + static inline const LocalHardRes* internal_default_instance() { + return reinterpret_cast( + &_LocalHardRes_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(LocalHardRes& a, LocalHardRes& b) { + a.Swap(&b); + } + inline void Swap(LocalHardRes* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LocalHardRes* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + LocalHardRes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const LocalHardRes& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom(const LocalHardRes& from); + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LocalHardRes* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Local.Status.LocalHardRes"; + } + protected: + explicit LocalHardRes(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kActionFieldNumber = 1, + kResultCodeFieldNumber = 2, + }; + // uint32 action = 1; + void clear_action(); + uint32_t action() const; + void set_action(uint32_t value); + private: + uint32_t _internal_action() const; + void _internal_set_action(uint32_t value); + public: + + // uint32 result_code = 2; + void clear_result_code(); + uint32_t result_code() const; + void set_result_code(uint32_t value); + private: + uint32_t _internal_result_code() const; + void _internal_set_result_code(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:Local.Status.LocalHardRes) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + uint32_t action_; + uint32_t result_code_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_Local_2eStatus_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// LocalDeviceReq + +// bool status = 1; +inline void LocalDeviceReq::clear_status() { + status_ = false; +} +inline bool LocalDeviceReq::_internal_status() const { + return status_; +} +inline bool LocalDeviceReq::status() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceReq.status) + return _internal_status(); +} +inline void LocalDeviceReq::_internal_set_status(bool value) { + + status_ = value; +} +inline void LocalDeviceReq::set_status(bool value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceReq.status) +} + +// string device_id = 2; +inline void LocalDeviceReq::clear_device_id() { + device_id_.ClearToEmpty(); +} +inline const std::string& LocalDeviceReq::device_id() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceReq.device_id) + return _internal_device_id(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalDeviceReq::set_device_id(ArgT0&& arg0, ArgT... args) { + + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceReq.device_id) +} +inline std::string* LocalDeviceReq::mutable_device_id() { + std::string* _s = _internal_mutable_device_id(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalDeviceReq.device_id) + return _s; +} +inline const std::string& LocalDeviceReq::_internal_device_id() const { + return device_id_.Get(); +} +inline void LocalDeviceReq::_internal_set_device_id(const std::string& value) { + + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalDeviceReq::_internal_mutable_device_id() { + + return device_id_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalDeviceReq::release_device_id() { + // @@protoc_insertion_point(field_release:Local.Status.LocalDeviceReq.device_id) + return device_id_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalDeviceReq::set_allocated_device_id(std::string* device_id) { + if (device_id != nullptr) { + + } else { + + } + device_id_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), device_id, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (device_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalDeviceReq.device_id) +} + +// string soft_version = 3; +inline void LocalDeviceReq::clear_soft_version() { + soft_version_.ClearToEmpty(); +} +inline const std::string& LocalDeviceReq::soft_version() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceReq.soft_version) + return _internal_soft_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalDeviceReq::set_soft_version(ArgT0&& arg0, ArgT... args) { + + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceReq.soft_version) +} +inline std::string* LocalDeviceReq::mutable_soft_version() { + std::string* _s = _internal_mutable_soft_version(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalDeviceReq.soft_version) + return _s; +} +inline const std::string& LocalDeviceReq::_internal_soft_version() const { + return soft_version_.Get(); +} +inline void LocalDeviceReq::_internal_set_soft_version(const std::string& value) { + + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalDeviceReq::_internal_mutable_soft_version() { + + return soft_version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalDeviceReq::release_soft_version() { + // @@protoc_insertion_point(field_release:Local.Status.LocalDeviceReq.soft_version) + return soft_version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalDeviceReq::set_allocated_soft_version(std::string* soft_version) { + if (soft_version != nullptr) { + + } else { + + } + soft_version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), soft_version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (soft_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalDeviceReq.soft_version) +} + +// uint64 heart_time = 4; +inline void LocalDeviceReq::clear_heart_time() { + heart_time_ = uint64_t{0u}; +} +inline uint64_t LocalDeviceReq::_internal_heart_time() const { + return heart_time_; +} +inline uint64_t LocalDeviceReq::heart_time() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceReq.heart_time) + return _internal_heart_time(); +} +inline void LocalDeviceReq::_internal_set_heart_time(uint64_t value) { + + heart_time_ = value; +} +inline void LocalDeviceReq::set_heart_time(uint64_t value) { + _internal_set_heart_time(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceReq.heart_time) +} + +// ------------------------------------------------------------------- + +// LocalDeviceRes + +// string device_id = 1; +inline void LocalDeviceRes::clear_device_id() { + device_id_.ClearToEmpty(); +} +inline const std::string& LocalDeviceRes::device_id() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceRes.device_id) + return _internal_device_id(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalDeviceRes::set_device_id(ArgT0&& arg0, ArgT... args) { + + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceRes.device_id) +} +inline std::string* LocalDeviceRes::mutable_device_id() { + std::string* _s = _internal_mutable_device_id(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalDeviceRes.device_id) + return _s; +} +inline const std::string& LocalDeviceRes::_internal_device_id() const { + return device_id_.Get(); +} +inline void LocalDeviceRes::_internal_set_device_id(const std::string& value) { + + device_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalDeviceRes::_internal_mutable_device_id() { + + return device_id_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalDeviceRes::release_device_id() { + // @@protoc_insertion_point(field_release:Local.Status.LocalDeviceRes.device_id) + return device_id_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalDeviceRes::set_allocated_device_id(std::string* device_id) { + if (device_id != nullptr) { + + } else { + + } + device_id_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), device_id, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (device_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + device_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalDeviceRes.device_id) +} + +// string soft_version = 2; +inline void LocalDeviceRes::clear_soft_version() { + soft_version_.ClearToEmpty(); +} +inline const std::string& LocalDeviceRes::soft_version() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceRes.soft_version) + return _internal_soft_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalDeviceRes::set_soft_version(ArgT0&& arg0, ArgT... args) { + + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceRes.soft_version) +} +inline std::string* LocalDeviceRes::mutable_soft_version() { + std::string* _s = _internal_mutable_soft_version(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalDeviceRes.soft_version) + return _s; +} +inline const std::string& LocalDeviceRes::_internal_soft_version() const { + return soft_version_.Get(); +} +inline void LocalDeviceRes::_internal_set_soft_version(const std::string& value) { + + soft_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalDeviceRes::_internal_mutable_soft_version() { + + return soft_version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalDeviceRes::release_soft_version() { + // @@protoc_insertion_point(field_release:Local.Status.LocalDeviceRes.soft_version) + return soft_version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalDeviceRes::set_allocated_soft_version(std::string* soft_version) { + if (soft_version != nullptr) { + + } else { + + } + soft_version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), soft_version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (soft_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + soft_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalDeviceRes.soft_version) +} + +// uint32 result_code = 3; +inline void LocalDeviceRes::clear_result_code() { + result_code_ = 0u; +} +inline uint32_t LocalDeviceRes::_internal_result_code() const { + return result_code_; +} +inline uint32_t LocalDeviceRes::result_code() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalDeviceRes.result_code) + return _internal_result_code(); +} +inline void LocalDeviceRes::_internal_set_result_code(uint32_t value) { + + result_code_ = value; +} +inline void LocalDeviceRes::set_result_code(uint32_t value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalDeviceRes.result_code) +} + +// ------------------------------------------------------------------- + +// LocalMqttReq + +// uint32 status = 1; +inline void LocalMqttReq::clear_status() { + status_ = 0u; +} +inline uint32_t LocalMqttReq::_internal_status() const { + return status_; +} +inline uint32_t LocalMqttReq::status() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalMqttReq.status) + return _internal_status(); +} +inline void LocalMqttReq::_internal_set_status(uint32_t value) { + + status_ = value; +} +inline void LocalMqttReq::set_status(uint32_t value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalMqttReq.status) +} + +// uint32 delay = 2; +inline void LocalMqttReq::clear_delay() { + delay_ = 0u; +} +inline uint32_t LocalMqttReq::_internal_delay() const { + return delay_; +} +inline uint32_t LocalMqttReq::delay() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalMqttReq.delay) + return _internal_delay(); +} +inline void LocalMqttReq::_internal_set_delay(uint32_t value) { + + delay_ = value; +} +inline void LocalMqttReq::set_delay(uint32_t value) { + _internal_set_delay(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalMqttReq.delay) +} + +// uint64 last_up = 3; +inline void LocalMqttReq::clear_last_up() { + last_up_ = uint64_t{0u}; +} +inline uint64_t LocalMqttReq::_internal_last_up() const { + return last_up_; +} +inline uint64_t LocalMqttReq::last_up() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalMqttReq.last_up) + return _internal_last_up(); +} +inline void LocalMqttReq::_internal_set_last_up(uint64_t value) { + + last_up_ = value; +} +inline void LocalMqttReq::set_last_up(uint64_t value) { + _internal_set_last_up(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalMqttReq.last_up) +} + +// uint64 last_down = 4; +inline void LocalMqttReq::clear_last_down() { + last_down_ = uint64_t{0u}; +} +inline uint64_t LocalMqttReq::_internal_last_down() const { + return last_down_; +} +inline uint64_t LocalMqttReq::last_down() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalMqttReq.last_down) + return _internal_last_down(); +} +inline void LocalMqttReq::_internal_set_last_down(uint64_t value) { + + last_down_ = value; +} +inline void LocalMqttReq::set_last_down(uint64_t value) { + _internal_set_last_down(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalMqttReq.last_down) +} + +// ------------------------------------------------------------------- + +// LocalMqttRes + +// uint32 result_code = 1; +inline void LocalMqttRes::clear_result_code() { + result_code_ = 0u; +} +inline uint32_t LocalMqttRes::_internal_result_code() const { + return result_code_; +} +inline uint32_t LocalMqttRes::result_code() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalMqttRes.result_code) + return _internal_result_code(); +} +inline void LocalMqttRes::_internal_set_result_code(uint32_t value) { + + result_code_ = value; +} +inline void LocalMqttRes::set_result_code(uint32_t value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalMqttRes.result_code) +} + +// ------------------------------------------------------------------- + +// LocalFeedReq + +// uint32 feed_count = 1; +inline void LocalFeedReq::clear_feed_count() { + feed_count_ = 0u; +} +inline uint32_t LocalFeedReq::_internal_feed_count() const { + return feed_count_; +} +inline uint32_t LocalFeedReq::feed_count() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalFeedReq.feed_count) + return _internal_feed_count(); +} +inline void LocalFeedReq::_internal_set_feed_count(uint32_t value) { + + feed_count_ = value; +} +inline void LocalFeedReq::set_feed_count(uint32_t value) { + _internal_set_feed_count(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalFeedReq.feed_count) +} + +// uint32 feed_weight = 2; +inline void LocalFeedReq::clear_feed_weight() { + feed_weight_ = 0u; +} +inline uint32_t LocalFeedReq::_internal_feed_weight() const { + return feed_weight_; +} +inline uint32_t LocalFeedReq::feed_weight() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalFeedReq.feed_weight) + return _internal_feed_weight(); +} +inline void LocalFeedReq::_internal_set_feed_weight(uint32_t value) { + + feed_weight_ = value; +} +inline void LocalFeedReq::set_feed_weight(uint32_t value) { + _internal_set_feed_weight(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalFeedReq.feed_weight) +} + +// string last_feed_time = 3; +inline void LocalFeedReq::clear_last_feed_time() { + last_feed_time_.ClearToEmpty(); +} +inline const std::string& LocalFeedReq::last_feed_time() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalFeedReq.last_feed_time) + return _internal_last_feed_time(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalFeedReq::set_last_feed_time(ArgT0&& arg0, ArgT... args) { + + last_feed_time_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalFeedReq.last_feed_time) +} +inline std::string* LocalFeedReq::mutable_last_feed_time() { + std::string* _s = _internal_mutable_last_feed_time(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalFeedReq.last_feed_time) + return _s; +} +inline const std::string& LocalFeedReq::_internal_last_feed_time() const { + return last_feed_time_.Get(); +} +inline void LocalFeedReq::_internal_set_last_feed_time(const std::string& value) { + + last_feed_time_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalFeedReq::_internal_mutable_last_feed_time() { + + return last_feed_time_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalFeedReq::release_last_feed_time() { + // @@protoc_insertion_point(field_release:Local.Status.LocalFeedReq.last_feed_time) + return last_feed_time_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalFeedReq::set_allocated_last_feed_time(std::string* last_feed_time) { + if (last_feed_time != nullptr) { + + } else { + + } + last_feed_time_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), last_feed_time, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (last_feed_time_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + last_feed_time_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalFeedReq.last_feed_time) +} + +// string last_feed_weight = 4; +inline void LocalFeedReq::clear_last_feed_weight() { + last_feed_weight_.ClearToEmpty(); +} +inline const std::string& LocalFeedReq::last_feed_weight() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalFeedReq.last_feed_weight) + return _internal_last_feed_weight(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void LocalFeedReq::set_last_feed_weight(ArgT0&& arg0, ArgT... args) { + + last_feed_weight_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Local.Status.LocalFeedReq.last_feed_weight) +} +inline std::string* LocalFeedReq::mutable_last_feed_weight() { + std::string* _s = _internal_mutable_last_feed_weight(); + // @@protoc_insertion_point(field_mutable:Local.Status.LocalFeedReq.last_feed_weight) + return _s; +} +inline const std::string& LocalFeedReq::_internal_last_feed_weight() const { + return last_feed_weight_.Get(); +} +inline void LocalFeedReq::_internal_set_last_feed_weight(const std::string& value) { + + last_feed_weight_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* LocalFeedReq::_internal_mutable_last_feed_weight() { + + return last_feed_weight_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* LocalFeedReq::release_last_feed_weight() { + // @@protoc_insertion_point(field_release:Local.Status.LocalFeedReq.last_feed_weight) + return last_feed_weight_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +} +inline void LocalFeedReq::set_allocated_last_feed_weight(std::string* last_feed_weight) { + if (last_feed_weight != nullptr) { + + } else { + + } + last_feed_weight_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), last_feed_weight, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (last_feed_weight_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + last_feed_weight_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Local.Status.LocalFeedReq.last_feed_weight) +} + +// ------------------------------------------------------------------- + +// LocalFeedRes + +// uint32 result_code = 1; +inline void LocalFeedRes::clear_result_code() { + result_code_ = 0u; +} +inline uint32_t LocalFeedRes::_internal_result_code() const { + return result_code_; +} +inline uint32_t LocalFeedRes::result_code() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalFeedRes.result_code) + return _internal_result_code(); +} +inline void LocalFeedRes::_internal_set_result_code(uint32_t value) { + + result_code_ = value; +} +inline void LocalFeedRes::set_result_code(uint32_t value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalFeedRes.result_code) +} + +// ------------------------------------------------------------------- + +// LocalHardReq + +// uint32 food_remain = 1; +inline void LocalHardReq::clear_food_remain() { + food_remain_ = 0u; +} +inline uint32_t LocalHardReq::_internal_food_remain() const { + return food_remain_; +} +inline uint32_t LocalHardReq::food_remain() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.food_remain) + return _internal_food_remain(); +} +inline void LocalHardReq::_internal_set_food_remain(uint32_t value) { + + food_remain_ = value; +} +inline void LocalHardReq::set_food_remain(uint32_t value) { + _internal_set_food_remain(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.food_remain) +} + +// uint32 temperature = 2; +inline void LocalHardReq::clear_temperature() { + temperature_ = 0u; +} +inline uint32_t LocalHardReq::_internal_temperature() const { + return temperature_; +} +inline uint32_t LocalHardReq::temperature() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.temperature) + return _internal_temperature(); +} +inline void LocalHardReq::_internal_set_temperature(uint32_t value) { + + temperature_ = value; +} +inline void LocalHardReq::set_temperature(uint32_t value) { + _internal_set_temperature(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.temperature) +} + +// bool motor = 3; +inline void LocalHardReq::clear_motor() { + motor_ = false; +} +inline bool LocalHardReq::_internal_motor() const { + return motor_; +} +inline bool LocalHardReq::motor() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.motor) + return _internal_motor(); +} +inline void LocalHardReq::_internal_set_motor(bool value) { + + motor_ = value; +} +inline void LocalHardReq::set_motor(bool value) { + _internal_set_motor(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.motor) +} + +// bool weight = 4; +inline void LocalHardReq::clear_weight() { + weight_ = false; +} +inline bool LocalHardReq::_internal_weight() const { + return weight_; +} +inline bool LocalHardReq::weight() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.weight) + return _internal_weight(); +} +inline void LocalHardReq::_internal_set_weight(bool value) { + + weight_ = value; +} +inline void LocalHardReq::set_weight(bool value) { + _internal_set_weight(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.weight) +} + +// bool door = 5; +inline void LocalHardReq::clear_door() { + door_ = false; +} +inline bool LocalHardReq::_internal_door() const { + return door_; +} +inline bool LocalHardReq::door() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.door) + return _internal_door(); +} +inline void LocalHardReq::_internal_set_door(bool value) { + + door_ = value; +} +inline void LocalHardReq::set_door(bool value) { + _internal_set_door(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.door) +} + +// bool stuck = 6; +inline void LocalHardReq::clear_stuck() { + stuck_ = false; +} +inline bool LocalHardReq::_internal_stuck() const { + return stuck_; +} +inline bool LocalHardReq::stuck() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardReq.stuck) + return _internal_stuck(); +} +inline void LocalHardReq::_internal_set_stuck(bool value) { + + stuck_ = value; +} +inline void LocalHardReq::set_stuck(bool value) { + _internal_set_stuck(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardReq.stuck) +} + +// ------------------------------------------------------------------- + +// LocalHardRes + +// uint32 action = 1; +inline void LocalHardRes::clear_action() { + action_ = 0u; +} +inline uint32_t LocalHardRes::_internal_action() const { + return action_; +} +inline uint32_t LocalHardRes::action() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardRes.action) + return _internal_action(); +} +inline void LocalHardRes::_internal_set_action(uint32_t value) { + + action_ = value; +} +inline void LocalHardRes::set_action(uint32_t value) { + _internal_set_action(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardRes.action) +} + +// uint32 result_code = 2; +inline void LocalHardRes::clear_result_code() { + result_code_ = 0u; +} +inline uint32_t LocalHardRes::_internal_result_code() const { + return result_code_; +} +inline uint32_t LocalHardRes::result_code() const { + // @@protoc_insertion_point(field_get:Local.Status.LocalHardRes.result_code) + return _internal_result_code(); +} +inline void LocalHardRes::_internal_set_result_code(uint32_t value) { + + result_code_ = value; +} +inline void LocalHardRes::set_result_code(uint32_t value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:Local.Status.LocalHardRes.result_code) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace Status +} // namespace Local + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_Local_2eStatus_2eproto diff --git a/audofeed-device-backend/rpc/localstatusclient.h b/audofeed-device-backend/rpc/localstatusclient.h new file mode 100644 index 0000000..8a7259f --- /dev/null +++ b/audofeed-device-backend/rpc/localstatusclient.h @@ -0,0 +1,156 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Local.Status.pb.h" +#include "Local.Status.grpc.pb.h" +#include +#include "easylogging++.h" + +using grpc::Channel; +using grpc::ClientContext; +using grpc::Server; +using grpc::ServerBuilder; +using grpc::ServerContext; +using grpc::Status; +using Local::Status::LocalStatus; +using Local::Status::LocalDeviceReq; +using Local::Status::LocalDeviceRes; +using Local::Status::LocalMqttReq; +using Local::Status::LocalMqttRes; +using Local::Status::LocalFeedReq; +using Local::Status::LocalFeedRes; +using Local::Status::LocalHardReq; +using Local::Status::LocalHardRes; + +constexpr char kDefaultServerAddress[] = "0.0.0.0:50051"; +constexpr char kDefaultClientTarget[] = "127.0.0.1:50051"; + +class LocalStatusClient { +public: + LocalStatusClient(std::shared_ptr channel) + : stub_(LocalStatus::NewStub(channel)){ + + } + + bool Device(const bool status, const std::string& device_id, const std::string& soft_version, + const uint64_t timestamp, LocalDeviceRes* out) { + LocalDeviceReq request; + request.set_status(status); + request.set_device_id(device_id); + request.set_soft_version(soft_version); + request.set_heart_time(timestamp); + + LocalDeviceRes response; + ClientContext context; + LOG(INFO) << "-> Device req"; + Status st = stub_->Device(&context, request, &response); + if (st.ok()) { + LOG(INFO) << "status:" << status << ", device_id:" << device_id + << ", soft_version:" << soft_version << ", heart_time:" << timestamp + << ", result_code:" << response.result_code(); + if (out != nullptr) { + *out = response; + } + return true; + } + + LOG(WARNING) << "Device rpc failed: status:" << status << ", device_id:" << device_id + << ", soft_version:" << soft_version << ", heart_time:" << timestamp; + return false; + } + + bool Mqtt(const uint32_t status, uint32_t delay, uint64_t last_up, uint64_t last_down, LocalMqttRes* out) { + LocalMqttReq request; + request.set_status(status); + request.set_delay(delay); + request.set_last_up(last_up); + request.set_last_down(last_down); + + LocalMqttRes response; + ClientContext context; + LOG(INFO) << "-> Mqtt req"; + Status st = stub_->Mqtt(&context, request, &response); + if (st.ok()) { + LOG(INFO) << "status:" << status << ", delay:" << delay << ", last_up:" << last_up + << ", last_down:" << last_down << ", result_code:" << response.result_code(); + if (out != nullptr) { + *out = response; + } + return true; + } + + LOG(WARNING) << "Mqtt rpc failed: status:" << status << ", delay:" << delay + << ", last_up:" << last_up << ", last_down:" << last_down; + return false; + } + + bool Feed(const uint32_t feed_count, const uint32_t feed_weight, const std::string& last_feed_time, + const std::string& last_feed_weight, LocalFeedRes* out) { + LocalFeedReq request; + request.set_feed_count(feed_count); + request.set_feed_weight(feed_weight); + request.set_last_feed_time(last_feed_time); + request.set_last_feed_weight(last_feed_weight); + + LocalFeedRes response; + ClientContext context; + LOG(INFO) << "-> Feed req"; + Status st = stub_->Feed(&context, request, &response); + if (st.ok()) { + LOG(INFO) << "feed_count:" << feed_count << ", feed_weight:" << feed_weight + << ", last_feed_time:" << last_feed_time + << ", last_feed_weight:" << last_feed_weight + << ", result_code:" << response.result_code(); + if (out != nullptr) { + *out = response; + } + return true; + } + + LOG(WARNING) << "Feed rpc failed: feed_count:" << feed_count + << ", feed_weight:" << feed_weight << ", last_feed_time:" << last_feed_time + << ", last_feed_weight:" << last_feed_weight; + return false; + } + + bool Hard(const uint32_t food_remain, const uint32_t temperature, const bool motor, const bool weight, + const bool door, const bool stuck, LocalHardRes* out) { + LocalHardReq request; + request.set_food_remain(food_remain); + request.set_temperature(temperature); + request.set_motor(motor); + request.set_weight(weight); + request.set_door(door); + request.set_stuck(stuck); + + LocalHardRes response; + ClientContext context; + LOG(INFO) << "-> Hard req"; + Status st = stub_->Hard(&context, request, &response); + if (st.ok()) { + LOG(INFO) << "food_remain:" << food_remain << ", temperature:" << temperature + << ", motor:" << motor << ", weight:" << weight << ", door:" << door + << ", stuck:" << stuck << ", action:" << response.action() + << ", result_code:" << response.result_code(); + if (out != nullptr) { + *out = response; + } + return true; + } + + LOG(WARNING) << "Hard rpc failed: food_remain:" << food_remain << ", temperature:" << temperature + << ", motor:" << motor << ", weight:" << weight << ", door:" << door + << ", stuck:" << stuck; + return false; + } + +private: + std::unique_ptr stub_; +}; \ No newline at end of file diff --git a/audofeed-device-backend/scripts/gen_rpc.sh b/audofeed-device-backend/scripts/gen_rpc.sh new file mode 100755 index 0000000..050ac9c --- /dev/null +++ b/audofeed-device-backend/scripts/gen_rpc.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +PROTO_DIR="${PROTO_DIR:-${ROOT_DIR}/proto}" +OUT_DIR="${OUT_DIR:-${ROOT_DIR}/rpc}" +PROTOC_BIN="${PROTOC_BIN:-protoc}" + +if ! command -v "${PROTOC_BIN}" >/dev/null 2>&1; then + echo "protoc not found (set PROTOC_BIN or install protobuf)." >&2 + exit 1 +fi + +if [[ -n "${GRPC_CPP_PLUGIN_PATH:-}" ]]; then + GRPC_PLUGIN="${GRPC_CPP_PLUGIN_PATH}" +else + GRPC_PLUGIN="$(command -v grpc_cpp_plugin || true)" +fi + +if [[ -z "${GRPC_PLUGIN}" ]]; then + echo "grpc_cpp_plugin not found (set GRPC_CPP_PLUGIN_PATH or install gRPC)." >&2 + exit 1 +fi + +if [[ ! -d "${PROTO_DIR}" ]]; then + echo "Proto dir not found: ${PROTO_DIR}" >&2 + exit 1 +fi + +mapfile -t PROTO_FILES < <(find "${PROTO_DIR}" -type f -name '*.proto' | sort) +if [[ "${#PROTO_FILES[@]}" -eq 0 ]]; then + echo "No .proto files found in ${PROTO_DIR}" >&2 + exit 1 +fi + +mkdir -p "${OUT_DIR}" + +"${PROTOC_BIN}" \ + --grpc_out "${OUT_DIR}" \ + --cpp_out "${OUT_DIR}" \ + -I "${PROTO_DIR}" \ + --plugin=protoc-gen-grpc="${GRPC_PLUGIN}" \ + "${PROTO_FILES[@]}" + +echo "Generated C++ sources into ${OUT_DIR}" diff --git a/audofeed-mobile/flutter_application_1/.gitignore b/audofeed-mobile/flutter_application_1/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/audofeed-mobile/flutter_application_1/.metadata b/audofeed-mobile/flutter_application_1/.metadata new file mode 100644 index 0000000..83b34eb --- /dev/null +++ b/audofeed-mobile/flutter_application_1/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "f6ff1529fd6d8af5f706051d9251ac9231c83407" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: android + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: ios + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: linux + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: macos + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: web + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + - platform: windows + create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/audofeed-mobile/flutter_application_1/README.md b/audofeed-mobile/flutter_application_1/README.md new file mode 100644 index 0000000..2c8a8ae --- /dev/null +++ b/audofeed-mobile/flutter_application_1/README.md @@ -0,0 +1,16 @@ +# flutter_application_1 + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/audofeed-mobile/flutter_application_1/analysis_options.yaml b/audofeed-mobile/flutter_application_1/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/audofeed-mobile/flutter_application_1/android/.gitignore b/audofeed-mobile/flutter_application_1/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/audofeed-mobile/flutter_application_1/android/app/build.gradle.kts b/audofeed-mobile/flutter_application_1/android/app/build.gradle.kts new file mode 100644 index 0000000..408d509 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.flutter_application_1" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.flutter_application_1" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/audofeed-mobile/flutter_application_1/android/app/src/debug/AndroidManifest.xml b/audofeed-mobile/flutter_application_1/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/AndroidManifest.xml b/audofeed-mobile/flutter_application_1/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..f2daf87 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/kotlin/com/example/flutter_application_1/MainActivity.kt b/audofeed-mobile/flutter_application_1/android/app/src/main/kotlin/com/example/flutter_application_1/MainActivity.kt new file mode 100644 index 0000000..aa48e52 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/kotlin/com/example/flutter_application_1/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.flutter_application_1 + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable-v21/launch_background.xml b/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable/launch_background.xml b/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/audofeed-mobile/flutter_application_1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/values-night/styles.xml b/audofeed-mobile/flutter_application_1/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/main/res/values/styles.xml b/audofeed-mobile/flutter_application_1/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/android/app/src/profile/AndroidManifest.xml b/audofeed-mobile/flutter_application_1/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/audofeed-mobile/flutter_application_1/android/build.gradle.kts b/audofeed-mobile/flutter_application_1/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/audofeed-mobile/flutter_application_1/android/gradle.properties b/audofeed-mobile/flutter_application_1/android/gradle.properties new file mode 100644 index 0000000..fbee1d8 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true diff --git a/audofeed-mobile/flutter_application_1/android/gradle/wrapper/gradle-wrapper.properties b/audofeed-mobile/flutter_application_1/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e4ef43f --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip diff --git a/audofeed-mobile/flutter_application_1/android/settings.gradle.kts b/audofeed-mobile/flutter_application_1/android/settings.gradle.kts new file mode 100644 index 0000000..ca7fe06 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false +} + +include(":app") diff --git a/audofeed-mobile/flutter_application_1/ios/.gitignore b/audofeed-mobile/flutter_application_1/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/audofeed-mobile/flutter_application_1/ios/Flutter/AppFrameworkInfo.plist b/audofeed-mobile/flutter_application_1/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..1dc6cf7 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/audofeed-mobile/flutter_application_1/ios/Flutter/Debug.xcconfig b/audofeed-mobile/flutter_application_1/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/ios/Flutter/Release.xcconfig b/audofeed-mobile/flutter_application_1/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.pbxproj b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..de2f601 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e3773d4 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/contents.xcworkspacedata b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/AppDelegate.swift b/audofeed-mobile/flutter_application_1/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/LaunchScreen.storyboard b/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/Main.storyboard b/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Info.plist b/audofeed-mobile/flutter_application_1/ios/Runner/Info.plist new file mode 100644 index 0000000..6dc955a --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Flutter Application 1 + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_application_1 + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/audofeed-mobile/flutter_application_1/ios/Runner/Runner-Bridging-Header.h b/audofeed-mobile/flutter_application_1/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/audofeed-mobile/flutter_application_1/ios/RunnerTests/RunnerTests.swift b/audofeed-mobile/flutter_application_1/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/audofeed-mobile/flutter_application_1/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/audofeed-mobile/flutter_application_1/lib/main.dart b/audofeed-mobile/flutter_application_1/lib/main.dart new file mode 100644 index 0000000..5b7386f --- /dev/null +++ b/audofeed-mobile/flutter_application_1/lib/main.dart @@ -0,0 +1,1272 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +void main() { + runApp(const AutoFeedApp()); +} + +class AutoFeedApp extends StatefulWidget { + const AutoFeedApp({super.key}); + + @override + State createState() => _AutoFeedAppState(); +} + +class _AutoFeedAppState extends State { + bool _isDark = true; + + ThemeData _buildTheme(AppColors colors, Brightness brightness) { + final colorScheme = ColorScheme.fromSeed( + seedColor: colors.primary, + brightness: brightness, + ).copyWith( + background: colors.backgroundMid, + surface: colors.surface, + primary: colors.primary, + secondary: colors.secondary, + ); + + return ThemeData( + useMaterial3: true, + colorScheme: colorScheme, + scaffoldBackgroundColor: Colors.transparent, + fontFamily: 'Source Han Sans SC', + fontFamilyFallback: const [ + 'Noto Sans SC', + 'PingFang SC', + 'Microsoft YaHei', + 'sans-serif', + ], + cardTheme: const CardThemeData( + elevation: 0, + margin: EdgeInsets.zero, + ), + textTheme: const TextTheme( + headlineLarge: TextStyle(fontSize: 28, fontWeight: FontWeight.w700), + headlineMedium: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), + titleMedium: TextStyle(fontSize: 16, fontWeight: FontWeight.w600), + bodyMedium: TextStyle(fontSize: 14, fontWeight: FontWeight.w500), + bodySmall: TextStyle(fontSize: 12, fontWeight: FontWeight.w500), + ), + extensions: [colors], + ); + } + + void _toggleTheme() { + setState(() => _isDark = !_isDark); + } + + @override + Widget build(BuildContext context) { + final lightTheme = _buildTheme(AppColors.light, Brightness.light); + final darkTheme = _buildTheme(AppColors.dark, Brightness.dark); + + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'AutoFeed', + theme: lightTheme, + darkTheme: darkTheme, + themeMode: _isDark ? ThemeMode.dark : ThemeMode.light, + home: AutoFeedDashboard( + isDark: _isDark, + onToggleTheme: _toggleTheme, + ), + ); + } +} + +class AutoFeedDashboard extends StatelessWidget { + const AutoFeedDashboard({ + super.key, + required this.isDark, + required this.onToggleTheme, + }); + + final bool isDark; + final VoidCallback onToggleTheme; + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, constraints) { + final showSidebar = constraints.maxWidth >= 1100; + final showBottomNav = constraints.maxWidth < 900; + return Scaffold( + bottomNavigationBar: showBottomNav ? const _BottomNavBar() : null, + body: Stack( + children: [ + const _BackgroundLayer(), + SafeArea( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (showSidebar) const _Sidebar(), + Expanded( + child: _DashboardMain( + showSidebar: showSidebar, + isDark: isDark, + onToggleTheme: onToggleTheme, + ), + ), + ], + ), + ), + ], + ), + ); + }, + ); + } +} + +class _BackgroundLayer extends StatelessWidget { + const _BackgroundLayer(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + colors.backgroundStart, + colors.backgroundMid, + colors.backgroundEnd, + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: Container( + decoration: BoxDecoration( + gradient: RadialGradient( + colors: [ + colors.glow, + Colors.transparent, + ], + radius: 1.2, + center: const Alignment(0.6, -0.8), + ), + ), + ), + ); + } +} + +class _Sidebar extends StatelessWidget { + const _Sidebar(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Container( + width: 260, + margin: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18), + decoration: BoxDecoration( + color: colors.sidebar, + borderRadius: BorderRadius.circular(24), + border: Border.all(color: colors.border), + boxShadow: const [ + BoxShadow( + color: Color(0x55000000), + blurRadius: 24, + offset: Offset(0, 12), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const _BrandHeader(), + const SizedBox(height: 12), + Divider(color: colors.border), + const SizedBox(height: 8), + const _NavItem( + icon: Icons.dashboard_rounded, + label: '概览', + selected: true, + ), + const _NavItem( + icon: Icons.videocam_rounded, + label: '实时视频', + ), + const _NavItem( + icon: Icons.restaurant_rounded, + label: '投喂控制', + ), + const _NavItem( + icon: Icons.wifi_rounded, + label: '设备与网络', + ), + const _NavItem( + icon: Icons.notifications_rounded, + label: '日志与告警', + ), + const Spacer(), + const _DeviceFooter(), + ], + ), + ); + } +} + +class _BrandHeader extends StatelessWidget { + const _BrandHeader(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Row( + children: [ + Container( + width: 44, + height: 44, + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient( + colors: [colors.primary, colors.secondary], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: Center( + child: Text( + 'AF', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 16, + color: colors.text, + ), + ), + ), + ), + const SizedBox(width: 12), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'AutoFeed', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + color: colors.text, + ), + ), + const SizedBox(height: 2), + Text( + '桌面端控制台', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + ], + ), + ], + ); + } +} + +class _NavItem extends StatelessWidget { + const _NavItem({ + required this.icon, + required this.label, + this.selected = false, + }); + + final IconData icon; + final String label; + final bool selected; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Container( + margin: const EdgeInsets.only(bottom: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: selected ? colors.navSelected : Colors.transparent, + ), + child: ListTile( + leading: Icon( + icon, + color: selected ? colors.primary : colors.text, + ), + title: Text( + label, + style: TextStyle( + color: selected ? colors.text : colors.text, + fontWeight: selected ? FontWeight.w700 : FontWeight.w500, + ), + ), + onTap: () {}, + contentPadding: const EdgeInsets.symmetric(horizontal: 12), + dense: true, + minLeadingWidth: 20, + ), + ); + } +} + +class _DeviceFooter extends StatelessWidget { + const _DeviceFooter(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '设备:AF-2189 · v1.4.2', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + const SizedBox(height: 12), + SizedBox( + width: double.infinity, + child: OutlinedButton.icon( + onPressed: () {}, + icon: const Icon(Icons.download_rounded, size: 16), + label: const Text('导出报表'), + style: OutlinedButton.styleFrom( + foregroundColor: colors.text, + side: BorderSide(color: colors.border), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14), + ), + padding: const EdgeInsets.symmetric(vertical: 12), + ), + ), + ), + ], + ); + } +} + +class _BottomNavBar extends StatefulWidget { + const _BottomNavBar(); + + @override + State<_BottomNavBar> createState() => _BottomNavBarState(); +} + +class _BottomNavBarState extends State<_BottomNavBar> { + int _index = 0; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return BottomNavigationBar( + currentIndex: _index, + onTap: (value) { + setState(() => _index = value); + }, + type: BottomNavigationBarType.fixed, + backgroundColor: colors.sidebar, + selectedItemColor: colors.primary, + unselectedItemColor: colors.muted, + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.dashboard_rounded), + label: '概览', + ), + BottomNavigationBarItem( + icon: Icon(Icons.videocam_rounded), + label: '视频', + ), + BottomNavigationBarItem( + icon: Icon(Icons.restaurant_rounded), + label: '投喂', + ), + BottomNavigationBarItem( + icon: Icon(Icons.wifi_rounded), + label: '网络', + ), + ], + ); + } +} + +class _DashboardMain extends StatelessWidget { + const _DashboardMain({ + required this.showSidebar, + required this.isDark, + required this.onToggleTheme, + }); + + final bool showSidebar; + final bool isDark; + final VoidCallback onToggleTheme; + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.fromLTRB(showSidebar ? 0 : 16, 16, 16, 16), + child: LayoutBuilder( + builder: (context, constraints) { + final maxWidth = constraints.maxWidth; + final isNarrow = maxWidth < 720; + final columns = maxWidth >= 1200 + ? 3 + : maxWidth >= 900 + ? 2 + : 1; + final spacing = 20.0; + final cardWidth = + (maxWidth - spacing * (columns - 1)) / columns; + + final cards = [ + const _DeviceOverviewCard(), + const _NetworkCard(), + const _FeedStatusCard(), + const _StorageCard(), + const _CameraCard(), + const _AlertsCard(), + ]; + + return Column( + children: [ + _TopBar( + isNarrow: isNarrow, + isDark: isDark, + onToggleTheme: onToggleTheme, + ), + const SizedBox(height: 16), + const _StatusBanner(), + const SizedBox(height: 16), + Expanded( + child: SingleChildScrollView( + child: Wrap( + spacing: spacing, + runSpacing: spacing, + children: List.generate(cards.length, (index) { + return SizedBox( + width: cardWidth, + child: _StaggeredReveal( + index: index, + child: cards[index], + ), + ); + }), + ), + ), + ), + ], + ); + }, + ), + ); + } +} + +class _TopBar extends StatelessWidget { + const _TopBar({ + required this.isNarrow, + required this.isDark, + required this.onToggleTheme, + }); + + final bool isNarrow; + final bool isDark; + final VoidCallback onToggleTheme; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + final titleBlock = Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '概览 Dashboard', + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.w700, + color: colors.text, + ), + ), + const SizedBox(height: 4), + Text( + '宠物投喂器桌面端控制面板', + style: TextStyle(color: colors.muted, fontSize: 13), + ), + ], + ); + + final actions = Wrap( + spacing: 8, + runSpacing: 8, + children: [ + IconButton( + onPressed: onToggleTheme, + icon: Icon(isDark ? Icons.light_mode_rounded : Icons.dark_mode_rounded), + color: colors.text, + tooltip: isDark ? '切换浅色' : '切换深色', + ), + OutlinedButton.icon( + onPressed: () {}, + icon: const Icon(Icons.settings_rounded, size: 16), + label: const Text('系统设置'), + style: OutlinedButton.styleFrom( + foregroundColor: colors.text, + side: BorderSide(color: colors.border), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(18), + ), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + ), + ), + ], + ); + + if (isNarrow) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + titleBlock, + const SizedBox(height: 12), + actions, + ], + ); + } + + return Row( + children: [ + titleBlock, + const Spacer(), + actions, + ], + ); + } +} + +class _StatusBanner extends StatelessWidget { + const _StatusBanner(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(18), + gradient: LinearGradient( + colors: [colors.statusBannerStart, colors.statusBannerEnd], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + border: Border.all(color: colors.statusBannerBorder), + ), + child: Row( + children: [ + Icon(Icons.cloud_off_rounded, color: colors.warning), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '网络与 MQTT 连接异常,部分数据可能已过期。', + style: TextStyle( + fontWeight: FontWeight.w600, + color: colors.text, + ), + ), + const SizedBox(height: 4), + Text( + '状态:断开 · 17:52:52', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + ], + ), + ), + OutlinedButton( + onPressed: () {}, + style: OutlinedButton.styleFrom( + foregroundColor: colors.text, + side: BorderSide(color: colors.border), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), + child: const Text('重新连接'), + ), + IconButton( + onPressed: () {}, + icon: const Icon(Icons.close_rounded), + color: colors.muted, + ), + ], + ), + ); + } +} + +class _DeviceOverviewCard extends StatelessWidget { + const _DeviceOverviewCard(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '设备概况', + trailing: _StatusPill(label: '离线', color: colors.danger), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + _InfoRow(label: '设备编号', value: 'AF-2189'), + _InfoRow(label: '固件版本', value: '1.4.2'), + SizedBox(height: 12), + _InfoRow(label: '最近心跳', value: '0 秒前'), + _InfoRow(label: '数据更新', value: '稳定'), + ], + ), + ); + } +} + +class _NetworkCard extends StatelessWidget { + const _NetworkCard(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '网络与 MQTT', + trailing: _StatusPill(label: '断开', color: colors.danger), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + _InfoRow(label: '延迟', value: '0 ms'), + _InfoRow(label: '丢包率', value: '0%'), + SizedBox(height: 12), + _InfoRow(label: '最近上行', value: '0 秒前'), + _InfoRow(label: '最近下行', value: '0 秒前'), + ], + ), + ); + } +} + +class _FeedStatusCard extends StatelessWidget { + const _FeedStatusCard(); + + void _showFeedDialog(BuildContext context) { + final controller = TextEditingController(); + bool touched = false; + showDialog( + context: context, + builder: (context) { + return StatefulBuilder( + builder: (context, setState) { + final grams = int.tryParse(controller.text); + final isValid = grams != null && grams > 0 && grams % 10 == 0; + String? errorText; + if (touched) { + if (controller.text.isEmpty) { + errorText = '请输入投喂重量'; + } else if (grams == null || grams <= 0) { + errorText = '请输入有效数字'; + } else if (grams % 10 != 0) { + errorText = '必须是 10 的倍数'; + } + } + + return AlertDialog( + title: const Text('立即投喂'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Text('请输入投喂重量(单位 g,10 的倍数)'), + const SizedBox(height: 12), + TextField( + controller: controller, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + decoration: InputDecoration( + hintText: '例如 20', + errorText: errorText, + ), + onChanged: (_) => setState(() => touched = true), + onSubmitted: (_) { + setState(() => touched = true); + if (isValid) { + Navigator.of(context).pop(); + } + }, + ), + ], + ), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(), + child: const Text('取消'), + ), + FilledButton( + onPressed: isValid ? () => Navigator.of(context).pop() : null, + child: const Text('确认投喂'), + ), + ], + ); + }, + ); + }, + ).whenComplete(controller.dispose); + } + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '投喂状态', + trailing: OutlinedButton( + onPressed: () => _showFeedDialog(context), + style: OutlinedButton.styleFrom( + foregroundColor: colors.text, + side: BorderSide(color: colors.border), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), + child: const Text('立即投喂'), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: const [ + Expanded( + child: _InfoRow(label: '今日投喂次数', value: '0 次'), + ), + Expanded( + child: _InfoRow(label: '累计克数', value: '0 g'), + ), + ], + ), + const SizedBox(height: 8), + Text( + '下一次自动投喂:未设置', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + ], + ), + ); + } +} + +class _StorageCard extends StatelessWidget { + const _StorageCard(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '料仓与传感器', + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: const [ + Expanded( + child: _InfoRow(label: '料量', value: '0%'), + ), + Expanded( + child: _InfoRow(label: '温度', value: '0°C'), + ), + ], + ), + const SizedBox(height: 16), + Divider(color: colors.border), + const SizedBox(height: 12), + const _SensorLine( + icon: Icons.settings_rounded, + label: '电机', + value: '未知', + ), + const _SensorLine( + icon: Icons.meeting_room_rounded, + label: '仓门', + value: '关闭', + ), + const _SensorLine( + icon: Icons.scale_rounded, + label: '称重', + value: '未知', + ), + const _SensorLine( + icon: Icons.check_circle_rounded, + label: '卡粮', + value: '正常', + ), + ], + ), + ); + } +} + +class _CameraCard extends StatelessWidget { + const _CameraCard(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '摄像头预览', + trailing: _StatusPill(label: '未连接', color: colors.muted), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + gradient: LinearGradient( + colors: [colors.cameraPreviewStart, colors.cameraPreviewEnd], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: AspectRatio( + aspectRatio: 16 / 9, + child: Center( + child: Icon( + Icons.videocam_off_rounded, + color: colors.muted, + size: 40, + ), + ), + ), + ), + const SizedBox(height: 8), + Text( + '16:9 预览占位', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + const SizedBox(height: 6), + Text( + 'WebRTC 通道:未建立', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + const SizedBox(height: 12), + SizedBox( + width: double.infinity, + child: OutlinedButton( + onPressed: () {}, + style: OutlinedButton.styleFrom( + foregroundColor: colors.text, + side: BorderSide(color: colors.border), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), + child: const Text('进入实时视频'), + ), + ), + ], + ), + ); + } +} + +class _AlertsCard extends StatelessWidget { + const _AlertsCard(); + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return DashboardCard( + title: '告警摘要', + trailing: _StatusPill(label: '暂无告警', color: colors.success), + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 24), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: colors.panel, + ), + child: Column( + children: [ + Icon(Icons.notifications_none_rounded, + color: colors.primary, size: 32), + const SizedBox(height: 8), + Text('暂无告警', + style: TextStyle( + fontWeight: FontWeight.w600, + color: colors.text, + )), + const SizedBox(height: 4), + Text( + '设备运行稳定', + style: TextStyle(color: colors.muted, fontSize: 12), + ), + ], + ), + ), + ); + } +} + +class DashboardCard extends StatelessWidget { + const DashboardCard({ + super.key, + required this.title, + required this.child, + this.trailing, + }); + + final String title; + final Widget child; + final Widget? trailing; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Container( + padding: const EdgeInsets.all(18), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + gradient: LinearGradient( + colors: [colors.cardTop, colors.cardBottom], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + border: Border.all(color: colors.border), + boxShadow: const [ + BoxShadow( + color: Color(0x66000000), + blurRadius: 18, + offset: Offset(0, 10), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + title, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + color: colors.text, + ), + ), + ), + if (trailing != null) trailing!, + ], + ), + const SizedBox(height: 16), + child, + ], + ), + ); + } +} + +class _InfoRow extends StatelessWidget { + const _InfoRow({required this.label, required this.value}); + + final String label; + final String value; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Padding( + padding: const EdgeInsets.only(bottom: 6), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(label, style: TextStyle(color: colors.muted)), + Text( + value, + style: TextStyle(fontWeight: FontWeight.w600, color: colors.text), + ), + ], + ), + ); + } +} + +class _SensorLine extends StatelessWidget { + const _SensorLine({ + required this.icon, + required this.label, + required this.value, + }); + + final IconData icon; + final String label; + final String value; + + @override + Widget build(BuildContext context) { + final colors = AppColors.of(context); + return Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Row( + children: [ + Icon(icon, size: 16, color: colors.muted), + const SizedBox(width: 8), + Expanded( + child: Text(label, style: TextStyle(color: colors.muted)), + ), + Text( + value, + style: TextStyle(fontWeight: FontWeight.w600, color: colors.text), + ), + ], + ), + ); + } +} + +class _StatusPill extends StatelessWidget { + const _StatusPill({required this.label, required this.color}); + + final String label; + final Color color; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(999), + color: color.withOpacity(0.16), + border: Border.all(color: color.withOpacity(0.6)), + ), + child: Text( + label, + style: TextStyle( + color: color, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + ), + ); + } +} + +class _StaggeredReveal extends StatelessWidget { + const _StaggeredReveal({required this.index, required this.child}); + + final int index; + final Widget child; + + @override + Widget build(BuildContext context) { + return TweenAnimationBuilder( + tween: Tween(begin: 0, end: 1), + duration: Duration(milliseconds: 350 + index * 90), + curve: Curves.easeOutCubic, + builder: (context, value, child) { + return Opacity( + opacity: value, + child: Transform.translate( + offset: Offset(0, (1 - value) * 18), + child: child, + ), + ); + }, + child: child, + ); + } +} + +class AppColors extends ThemeExtension { + const AppColors({ + required this.primary, + required this.secondary, + required this.backgroundStart, + required this.backgroundMid, + required this.backgroundEnd, + required this.glow, + required this.surface, + required this.sidebar, + required this.panel, + required this.cardTop, + required this.cardBottom, + required this.border, + required this.navSelected, + required this.text, + required this.muted, + required this.warning, + required this.danger, + required this.success, + required this.statusBannerStart, + required this.statusBannerEnd, + required this.statusBannerBorder, + required this.cameraPreviewStart, + required this.cameraPreviewEnd, + }); + + final Color primary; + final Color secondary; + final Color backgroundStart; + final Color backgroundMid; + final Color backgroundEnd; + final Color glow; + final Color surface; + final Color sidebar; + final Color panel; + final Color cardTop; + final Color cardBottom; + final Color border; + final Color navSelected; + final Color text; + final Color muted; + final Color warning; + final Color danger; + final Color success; + final Color statusBannerStart; + final Color statusBannerEnd; + final Color statusBannerBorder; + final Color cameraPreviewStart; + final Color cameraPreviewEnd; + + static AppColors of(BuildContext context) { + return Theme.of(context).extension()!; + } + + static const AppColors dark = AppColors( + primary: Color(0xFF3BE2C2), + secondary: Color(0xFF5EEAD4), + backgroundStart: Color(0xFF0B0E13), + backgroundMid: Color(0xFF0F141B), + backgroundEnd: Color(0xFF0D1016), + glow: Color(0x332DD4BF), + surface: Color(0xFF151A22), + sidebar: Color(0xFF151921), + panel: Color(0xFF1B2230), + cardTop: Color(0xFF171C25), + cardBottom: Color(0xFF131822), + border: Color(0xFF2A3142), + navSelected: Color(0xFF1F2533), + text: Color(0xFFE4E9F2), + muted: Color(0xFF98A1B2), + warning: Color(0xFFE3B341), + danger: Color(0xFFF97316), + success: Color(0xFF34D399), + statusBannerStart: Color(0xFF2B2512), + statusBannerEnd: Color(0xFF1A1D20), + statusBannerBorder: Color(0xFF55421E), + cameraPreviewStart: Color(0xFF2A3242), + cameraPreviewEnd: Color(0xFF1B2130), + ); + + static const AppColors light = AppColors( + primary: Color(0xFF0A7C6F), + secondary: Color(0xFF4FBFA8), + backgroundStart: Color(0xFFF6F9F8), + backgroundMid: Color(0xFFF0F4F3), + backgroundEnd: Color(0xFFEAEFF1), + glow: Color(0x334FBFA8), + surface: Color(0xFFFFFFFF), + sidebar: Color(0xFFF1F5F4), + panel: Color(0xFFE8EEF0), + cardTop: Color(0xFFFFFFFF), + cardBottom: Color(0xFFF3F6F7), + border: Color(0xFFD7DEE1), + navSelected: Color(0xFFE5ECEB), + text: Color(0xFF1C2328), + muted: Color(0xFF6C7780), + warning: Color(0xFFD5962D), + danger: Color(0xFFE5672E), + success: Color(0xFF2FAD6F), + statusBannerStart: Color(0xFFFFF2D8), + statusBannerEnd: Color(0xFFF7F1E6), + statusBannerBorder: Color(0xFFE1C58C), + cameraPreviewStart: Color(0xFFE3E9EF), + cameraPreviewEnd: Color(0xFFD6DDE5), + ); + + @override + AppColors copyWith({ + Color? primary, + Color? secondary, + Color? backgroundStart, + Color? backgroundMid, + Color? backgroundEnd, + Color? glow, + Color? surface, + Color? sidebar, + Color? panel, + Color? cardTop, + Color? cardBottom, + Color? border, + Color? navSelected, + Color? text, + Color? muted, + Color? warning, + Color? danger, + Color? success, + Color? statusBannerStart, + Color? statusBannerEnd, + Color? statusBannerBorder, + Color? cameraPreviewStart, + Color? cameraPreviewEnd, + }) { + return AppColors( + primary: primary ?? this.primary, + secondary: secondary ?? this.secondary, + backgroundStart: backgroundStart ?? this.backgroundStart, + backgroundMid: backgroundMid ?? this.backgroundMid, + backgroundEnd: backgroundEnd ?? this.backgroundEnd, + glow: glow ?? this.glow, + surface: surface ?? this.surface, + sidebar: sidebar ?? this.sidebar, + panel: panel ?? this.panel, + cardTop: cardTop ?? this.cardTop, + cardBottom: cardBottom ?? this.cardBottom, + border: border ?? this.border, + navSelected: navSelected ?? this.navSelected, + text: text ?? this.text, + muted: muted ?? this.muted, + warning: warning ?? this.warning, + danger: danger ?? this.danger, + success: success ?? this.success, + statusBannerStart: statusBannerStart ?? this.statusBannerStart, + statusBannerEnd: statusBannerEnd ?? this.statusBannerEnd, + statusBannerBorder: statusBannerBorder ?? this.statusBannerBorder, + cameraPreviewStart: cameraPreviewStart ?? this.cameraPreviewStart, + cameraPreviewEnd: cameraPreviewEnd ?? this.cameraPreviewEnd, + ); + } + + @override + AppColors lerp(ThemeExtension? other, double t) { + if (other is! AppColors) { + return this; + } + return AppColors( + primary: Color.lerp(primary, other.primary, t)!, + secondary: Color.lerp(secondary, other.secondary, t)!, + backgroundStart: Color.lerp(backgroundStart, other.backgroundStart, t)!, + backgroundMid: Color.lerp(backgroundMid, other.backgroundMid, t)!, + backgroundEnd: Color.lerp(backgroundEnd, other.backgroundEnd, t)!, + glow: Color.lerp(glow, other.glow, t)!, + surface: Color.lerp(surface, other.surface, t)!, + sidebar: Color.lerp(sidebar, other.sidebar, t)!, + panel: Color.lerp(panel, other.panel, t)!, + cardTop: Color.lerp(cardTop, other.cardTop, t)!, + cardBottom: Color.lerp(cardBottom, other.cardBottom, t)!, + border: Color.lerp(border, other.border, t)!, + navSelected: Color.lerp(navSelected, other.navSelected, t)!, + text: Color.lerp(text, other.text, t)!, + muted: Color.lerp(muted, other.muted, t)!, + warning: Color.lerp(warning, other.warning, t)!, + danger: Color.lerp(danger, other.danger, t)!, + success: Color.lerp(success, other.success, t)!, + statusBannerStart: + Color.lerp(statusBannerStart, other.statusBannerStart, t)!, + statusBannerEnd: + Color.lerp(statusBannerEnd, other.statusBannerEnd, t)!, + statusBannerBorder: + Color.lerp(statusBannerBorder, other.statusBannerBorder, t)!, + cameraPreviewStart: + Color.lerp(cameraPreviewStart, other.cameraPreviewStart, t)!, + cameraPreviewEnd: + Color.lerp(cameraPreviewEnd, other.cameraPreviewEnd, t)!, + ); + } +} diff --git a/audofeed-mobile/flutter_application_1/linux/.gitignore b/audofeed-mobile/flutter_application_1/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/audofeed-mobile/flutter_application_1/linux/CMakeLists.txt b/audofeed-mobile/flutter_application_1/linux/CMakeLists.txt new file mode 100644 index 0000000..900e421 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "flutter_application_1") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.flutter_application_1") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/audofeed-mobile/flutter_application_1/linux/flutter/CMakeLists.txt b/audofeed-mobile/flutter_application_1/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.cc b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.h b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugins.cmake b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/audofeed-mobile/flutter_application_1/linux/runner/CMakeLists.txt b/audofeed-mobile/flutter_application_1/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/audofeed-mobile/flutter_application_1/linux/runner/main.cc b/audofeed-mobile/flutter_application_1/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/runner/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/audofeed-mobile/flutter_application_1/linux/runner/my_application.cc b/audofeed-mobile/flutter_application_1/linux/runner/my_application.cc new file mode 100644 index 0000000..9f21c16 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/runner/my_application.cc @@ -0,0 +1,148 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView* view) { + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "flutter_application_1"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "flutter_application_1"); + } + + gtk_window_set_default_size(window, 1280, 720); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments( + project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 + // for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), + self); + gtk_widget_realize(GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, + gchar*** arguments, + int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + // MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = + my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, "flags", + G_APPLICATION_NON_UNIQUE, nullptr)); +} diff --git a/audofeed-mobile/flutter_application_1/linux/runner/my_application.h b/audofeed-mobile/flutter_application_1/linux/runner/my_application.h new file mode 100644 index 0000000..db16367 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/linux/runner/my_application.h @@ -0,0 +1,21 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, + my_application, + MY, + APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/audofeed-mobile/flutter_application_1/macos/.gitignore b/audofeed-mobile/flutter_application_1/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Debug.xcconfig b/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Release.xcconfig b/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/macos/Flutter/GeneratedPluginRegistrant.swift b/audofeed-mobile/flutter_application_1/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..cccf817 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.pbxproj b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6f24dd9 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,705 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* flutter_application_1.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "flutter_application_1.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* flutter_application_1.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* flutter_application_1.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_application_1.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_application_1"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_application_1.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_application_1"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/flutter_application_1.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/flutter_application_1"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..5f39897 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/contents.xcworkspacedata b/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/AppDelegate.swift b/audofeed-mobile/flutter_application_1/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..b3c1761 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/audofeed-mobile/flutter_application_1/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Base.lproj/MainMenu.xib b/audofeed-mobile/flutter_application_1/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Configs/AppInfo.xcconfig b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..e5b4e71 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = flutter_application_1 + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApplication1 + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Debug.xcconfig b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Release.xcconfig b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Warnings.xcconfig b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/DebugProfile.entitlements b/audofeed-mobile/flutter_application_1/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Info.plist b/audofeed-mobile/flutter_application_1/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/MainFlutterWindow.swift b/audofeed-mobile/flutter_application_1/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..3cc05eb --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/audofeed-mobile/flutter_application_1/macos/Runner/Release.entitlements b/audofeed-mobile/flutter_application_1/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/audofeed-mobile/flutter_application_1/macos/RunnerTests/RunnerTests.swift b/audofeed-mobile/flutter_application_1/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..61f3bd1 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/audofeed-mobile/flutter_application_1/pubspec.lock b/audofeed-mobile/flutter_application_1/pubspec.lock new file mode 100644 index 0000000..3552175 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/pubspec.lock @@ -0,0 +1,213 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 + url: "https://pub.dev" + source: hosted + version: "6.0.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" + source: hosted + version: "0.7.7" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" +sdks: + dart: ">=3.10.4 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/audofeed-mobile/flutter_application_1/pubspec.yaml b/audofeed-mobile/flutter_application_1/pubspec.yaml new file mode 100644 index 0000000..d890685 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/pubspec.yaml @@ -0,0 +1,89 @@ +name: flutter_application_1 +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.10.4 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/audofeed-mobile/flutter_application_1/test/widget_test.dart b/audofeed-mobile/flutter_application_1/test/widget_test.dart new file mode 100644 index 0000000..2808800 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:flutter_application_1/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/audofeed-mobile/flutter_application_1/web/favicon.png b/audofeed-mobile/flutter_application_1/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/audofeed-mobile/flutter_application_1/web/favicon.png differ diff --git a/audofeed-mobile/flutter_application_1/web/icons/Icon-192.png b/audofeed-mobile/flutter_application_1/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/audofeed-mobile/flutter_application_1/web/icons/Icon-192.png differ diff --git a/audofeed-mobile/flutter_application_1/web/icons/Icon-512.png b/audofeed-mobile/flutter_application_1/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/web/icons/Icon-512.png differ diff --git a/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-192.png b/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-192.png differ diff --git a/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-512.png b/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/audofeed-mobile/flutter_application_1/web/icons/Icon-maskable-512.png differ diff --git a/audofeed-mobile/flutter_application_1/web/index.html b/audofeed-mobile/flutter_application_1/web/index.html new file mode 100644 index 0000000..34a4134 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + flutter_application_1 + + + + + + diff --git a/audofeed-mobile/flutter_application_1/web/manifest.json b/audofeed-mobile/flutter_application_1/web/manifest.json new file mode 100644 index 0000000..dd8e066 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "flutter_application_1", + "short_name": "flutter_application_1", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/audofeed-mobile/flutter_application_1/windows/.gitignore b/audofeed-mobile/flutter_application_1/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/audofeed-mobile/flutter_application_1/windows/CMakeLists.txt b/audofeed-mobile/flutter_application_1/windows/CMakeLists.txt new file mode 100644 index 0000000..8cc860b --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(flutter_application_1 LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "flutter_application_1") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/audofeed-mobile/flutter_application_1/windows/flutter/CMakeLists.txt b/audofeed-mobile/flutter_application_1/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..903f489 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.cc b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.h b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugins.cmake b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..b93c4c3 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/audofeed-mobile/flutter_application_1/windows/runner/CMakeLists.txt b/audofeed-mobile/flutter_application_1/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/audofeed-mobile/flutter_application_1/windows/runner/Runner.rc b/audofeed-mobile/flutter_application_1/windows/runner/Runner.rc new file mode 100644 index 0000000..765011b --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "flutter_application_1" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "flutter_application_1" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "flutter_application_1.exe" "\0" + VALUE "ProductName", "flutter_application_1" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.cpp b/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..955ee30 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.h b/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/audofeed-mobile/flutter_application_1/windows/runner/main.cpp b/audofeed-mobile/flutter_application_1/windows/runner/main.cpp new file mode 100644 index 0000000..bb23060 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"flutter_application_1", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/audofeed-mobile/flutter_application_1/windows/runner/resource.h b/audofeed-mobile/flutter_application_1/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/audofeed-mobile/flutter_application_1/windows/runner/resources/app_icon.ico b/audofeed-mobile/flutter_application_1/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/audofeed-mobile/flutter_application_1/windows/runner/resources/app_icon.ico differ diff --git a/audofeed-mobile/flutter_application_1/windows/runner/runner.exe.manifest b/audofeed-mobile/flutter_application_1/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..153653e --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/audofeed-mobile/flutter_application_1/windows/runner/utils.cpp b/audofeed-mobile/flutter_application_1/windows/runner/utils.cpp new file mode 100644 index 0000000..3a0b465 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/audofeed-mobile/flutter_application_1/windows/runner/utils.h b/audofeed-mobile/flutter_application_1/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/audofeed-mobile/flutter_application_1/windows/runner/win32_window.cpp b/audofeed-mobile/flutter_application_1/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/audofeed-mobile/flutter_application_1/windows/runner/win32_window.h b/audofeed-mobile/flutter_application_1/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/audofeed-mobile/flutter_application_1/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_ diff --git a/autofeed-device-front b/autofeed-device-front new file mode 160000 index 0000000..c687c32 --- /dev/null +++ b/autofeed-device-front @@ -0,0 +1 @@ +Subproject commit c687c32f061f61cf75c7c0b7bbb58df6c37f802f