Get the FieldOptions for this field. See Descriptor::DebugString. PrintableNameForExtension const. TypeToCppType Type type. Helper method to get the CppType for a particular Type. TypeName Type type. Helper method to get the name of a Type. Helper method to get the name of a CppType. Negative numbers take 10 bytes. Users may not declare fields that use reserved numbers. Excludes singular proto3 fields that do not have a label.
If no explicit default was defined, the default is 0. If no explicit default was defined, the default is false. If no explicit default was defined, the default is the empty string. For extensions, this is the extended type. Otherwise, returns null. This includes things listed in square brackets after the field definition.
OneofDescriptorProto Proto. Fully-qualified name of the oneof. Index of this oneof within the message's oneof array. Returns whether this oneof was inserted by the compiler to wrap a proto3 optional field. The Descriptor for the message containing this oneof. The number of non-extension fields which are members of this oneof. Get a member of this oneof, in the order in which they were declared in the. If this returns true, code generators should not emit it.
Does not include extensions. EnumDescriptorProto Proto. The name of this enum type in the containing scope. The fully-qualified name of the enum type, scope delimited by periods. Index of this enum within the file or containing message's enum array. Looks up a value by name. FindValueByNumber int number const. Looks up a value by number. If this enum type is nested in a message type, this is that message type.
Get options for this enum type. Returns true if this is a placeholder for an unknown enum. Guaranteed to be greater than zero. Otherwise, nullptr. EnumValueDescriptorProto Proto. Index within the enums's Descriptor. Numeric value of this enum constant. The type of this value. Get options for this enum value. ServiceDescriptorProto Proto. The name of the service, not including its containing scope. The fully-qualified name of the service, scope delimited by periods.
Index of this service within the file's services array. Get options for this service type. The number of methods this service defines. Look up a MethodDescriptor by name. MethodDescriptorProto Proto. Name of this method, not including containing scope.
The fully-qualified name of the method, scope delimited by periods. Index within the service's Descriptor. Gets the service to which this method belongs. Gets the type of protocol message which this method accepts as input. Gets the type of protocol message which this message produces as output. Gets whether the client streams multiple requests. Gets whether the server streams multiple responses. Get options for this method. Syntax of this file. FileDescriptorProto Proto. The filename, relative to the source tree.
The package, e. The number of files imported by this one. The number of files public imported by this one. The number of files that are imported for weak fields. Number of top-level message types defined in this file. Number of top-level enum types defined in this file. Number of services defined in this file. Number of extensions defined at file scope. Get options for this file. Find a top-level enum type by name. Returns nullptr if not found.
Find an enum value defined in any top-level enum by name. Find a service definition by name. Find a top-level extension definition by name.
Returns true if this is a placeholder for an unknown file. SyntaxName Syntax syntax. The public dependency list is a subset of the dependency list. The weak dependency list is a subset of the dependency list. This does not include nested types.
This does not include extensions nested within message types. Notes: This method does NOT copy source code information since it is relatively large and rarely needed. Create a normal, empty DescriptorPool. Get a pointer to the generated pool. These find descriptors by fully-qualified name. These will find both top-level descriptors and nested descriptors.
They return nullptr if not found. Finds an extension of the given type by number. Finds an extension of the given type by its printable name. Finds extensions of extendee. Same as BuildFile except errors are sent to the given ErrorCollector.
EnforceWeakDependencies bool enforce. These methods may contain hidden pitfalls and may be removed in a future library version.
For internal use only: Changes the behavior of BuildFile such that it allows the file to make reference to message types declared in other files which it did not officially declare as dependencies. For internal use only: Enables lazy building of dependencies of a file.
For internal use only: Gets a non-const pointer to the generated pool. For internal use only: Gets a non-const pointer to the generated descriptor database.
Useful for testing lazy descriptor initialization behavior. DescriptorBuilder will log warnings or errors for those files if there is any unused import. Do NOT call this in your own code! Only used for testing. These constants specify what exact part of the construct is broken. Reports an error in the FileDescriptorProto. Reports a warning in the FileDescriptorProto. This is useful e.
Use this function if the problem occurred should interrupt building the FileDescriptorProto. SourceLocation NB, all indices are zero-based.
DebugStringOptions Options when generating machine-parsable output from a descriptor with DebugString. Descriptor Describes a type of protocol message, or a particular group within a message. Descriptor::ExtensionRange A range of field numbers which are designated for third-party extensions. This is a true file handle that can be used with all C file API.
It should also allow seeking, something not possible if you work with pipes as pipes support no seeking you can emulate forward seeking but there is no way to ever seek backwards. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to get file descriptor of buffer in memory? Ask Question.
Asked 12 years, 3 months ago. Active 2 years, 11 months ago. Viewed 20k times. Improve this question. Community Bot 1 1 1 silver badge.
Add a comment. Active Oldest Votes. Improve this answer. On Linux, vmsplice might be useful: it avoids the need for a for-loop to write data to the pipe. Another way to access a file is fs. Once a file is accessed, you can read data from it using fs.
The fs. To open a file for writing, just change the flag parameter r to w , for example:. A file descriptor is a handle used to access a file.
0コメント