Capture headers discussion from recent SDK meetings (#1145)
This commit is contained in:
Родитель
187df78780
Коммит
5dae8fabb3
|
@ -156,8 +156,6 @@ struct hash_computation_private_details {
|
|||
} // namespace azure::group::api
|
||||
{% endhighlight %}
|
||||
|
||||
The definition of types must be placed in the `*_api.h` file for the module.
|
||||
|
||||
{% include requirement/SHOULD id="cpp-design-naming-classstatic" %} declare all types that are only used within the same source file in an unnamed namespace. Such types may contain only the function name (no prefixes). For example:
|
||||
|
||||
{% highlight cpp %}
|
||||
|
@ -341,8 +339,6 @@ namespace _details {
|
|||
} // namespace azure::group::api
|
||||
{% endhighlight %}
|
||||
|
||||
The definition of the function must be placed in the `*_api.h` file for the module.
|
||||
|
||||
{% include requirement/SHOULD id="cpp-design-naming-funcstatic" %} declare all functions that are only used within the same source file in an unnamed namespace. Static functions may contain only the function name (no prefixes). For example:
|
||||
|
||||
{% highlight cpp %}
|
||||
|
|
|
@ -14,7 +14,7 @@ sidebar: cpp_sidebar
|
|||
|
||||
### Windows
|
||||
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
|----------------------|---------------|---------------|-----------------------------------------|------
|
||||
| Windows Client | 7 SP1+, 8.1 | x86 | MSVC 14.16.x, MSVC 14.20x |
|
||||
| Windows 10 Client | Version 1607+ | x64, x86 | MSVC 14.16.x, MSVC 14.20x |
|
||||
|
@ -23,13 +23,13 @@ sidebar: cpp_sidebar
|
|||
|
||||
### Mac
|
||||
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
|---------------------------------|---------------|---------------|-----------------------------------------|------
|
||||
| macOS | 10.13+ | x64 | XCode 9.4.1 |
|
||||
|
||||
### Linux
|
||||
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
| Operating System | Version | Architectures | Compiler Version | Notes
|
||||
|---------------------------------|---------------|---------------|-----------------------------------------|------
|
||||
| Red Hat Enterprise Linux <br> CentOS <br> Oracle Linux | 7+ | x64 | gcc-4.8 | [Red Hat lifecycle](https://access.redhat.com/support/policy/updates/errata/) <br> [CentOS lifecycle](https://wiki.centos.org/FAQ/General#head-fe8a0be91ee3e7dea812e8694491e1dde5b75e6d) <br> [Oracle Linux lifecycle](http://www.oracle.com/us/support/library/elsp-lifetime-069338.pdf)
|
||||
| Debian | 9+ | x64 | gcc-6.3 | [Debian lifecycle](https://wiki.debian.org/DebianReleases)
|
||||
|
@ -301,11 +301,9 @@ TEST_FUNCTION(foo_tcp_manager_create_createAndReturnInstanceSucceed)
|
|||
|
||||
### Files
|
||||
|
||||
{% include requirement/MUST id="cpp-style-filenaming" %} name all files as lowercase, prefixed by the service short name; separate words with underscores, and end with the appropriate extension (`.c`, `.cpp`, or `.h`). For example, `iot_credential.c` is valid, while `IoTCredential.cl` is not.
|
||||
{% include requirement/MUST id="cpp-style-filenaming" %} name all files as lowercase, in a directory of the service short name. Separate words with underscores, and end with the appropriate extension (`.cpp` or `.hpp`). For example, `iot_credential.cpp` is valid, while `IoTCredential.cl` is not.
|
||||
|
||||
{% include requirement/MUST id="cpp-style-publicapi-hdr" %} identify the file containing the public API with `<svcname>_<objname>_api.h`. For example, `iot_credential_api.h`.
|
||||
|
||||
{% include requirement/MUST id="cpp-style-privateapi-hdr" %} place an include file that is not part of the public API in an `internal` directory. Do not include the service short name. For example, `internal/credential.h`.
|
||||
{% include requirement/MUST id="cpp-style-privateapi-hdr" %} place an include file that is not part of the public API in an `internal` directory. Do not include the service short name. For example, `<azure/internal/credential.hpp>`.
|
||||
|
||||
{% include requirement/MUST id="cpp-style-filenames" %} use characters in the range `[a-z0-9_]` for the name portion (before the file extension). No other characters are permitted.
|
||||
|
||||
|
@ -319,6 +317,12 @@ Filenames should be concise, but convey what role the file plays within the libr
|
|||
// Contents of a given header
|
||||
{% endhighlight %}
|
||||
|
||||
{% include requirement/MAY id="cpp-style-whole-sdk-header" %} have a header file that includes an entire client library. For example, `<azure/speech.hpp>`.
|
||||
|
||||
{% include requirement/SHOULD id="cpp-style-sub-sdk-header" %} have headers for smaller components that make sense to be used together. For example, `<azure/speech/translation.hpp>`.
|
||||
|
||||
{% include requirement/MUSTNOT id="cpp-style-change-headers" %} substantially change the names exposed by the header in response to macros or other controls. For example, `NOMINMAX` or `WIN32_LEAN_AND_MEAN` from `<Windows.h>`.
|
||||
|
||||
## Tooling
|
||||
|
||||
We use a common build and test pipeline to provide for automatic distribution of client libraries. To support this, we need common tooling.
|
||||
|
@ -394,8 +398,8 @@ CMake will automatically generate an appropriate export header:
|
|||
|
||||
{% highlight cmake %}
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(appconf
|
||||
EXPORT_FILE_NAME az/appconf_export.h)
|
||||
generate_export_header(speech
|
||||
EXPORT_FILE_NAME azure/speech_export.hpp)
|
||||
{% endhighlight %}
|
||||
|
||||
{% include requirement/MUST id="cpp-tooling-cpp-format" %} use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) for formatting, with the following command-line options:
|
||||
|
@ -653,7 +657,7 @@ Always add a short comment explaining why it is commented out.
|
|||
{% include requirement/MUSTNOT id="cpp-" %} put data definitions in header files. For example, this should be avoided:
|
||||
|
||||
{% highlight cpp %}
|
||||
/* aheader.h */
|
||||
/* aheader.hpp */
|
||||
int x = 0;
|
||||
{% endhighlight %}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче