Struct qt_core::q_io_device::OpenModeFlag
source · pub struct OpenModeFlag(/* private fields */);
Expand description
This enum is used with open() to describe the mode in which a device is opened. It is also returned by openMode().
C++ enum: QIODevice::OpenModeFlag
.
This enum is used with open() to describe the mode in which a device is opened. It is also returned by openMode().
Certain flags, such as Unbuffered
and Truncate
, are meaningless when used with some subclasses. Some of these restrictions are implied by the type of device that is represented by a subclass. In other cases, the restriction may be due to the implementation, or may be imposed by the underlying platform; for example, QTcpSocket does not support Unbuffered
mode, and limitations in the native API prevent QFile from supporting Unbuffered
on Windows.
The OpenMode type is a typedef for QFlags<OpenModeFlag>. It stores an OR combination of OpenModeFlag values.
Implementations§
source§impl OpenModeFlag
impl OpenModeFlag
sourcepub const NotOpen: OpenModeFlag = _
pub const NotOpen: OpenModeFlag = _
The device is not open. (C++ enum variant: NotOpen = 0
)
sourcepub const ReadOnly: OpenModeFlag = _
pub const ReadOnly: OpenModeFlag = _
The device is open for reading. (C++ enum variant: ReadOnly = 1
)
sourcepub const WriteOnly: OpenModeFlag = _
pub const WriteOnly: OpenModeFlag = _
The device is open for writing. Note that this mode implies Truncate. (C++ enum variant: WriteOnly = 2
)
sourcepub const ReadWrite: OpenModeFlag = _
pub const ReadWrite: OpenModeFlag = _
The device is open for reading and writing. (C++ enum variant: ReadWrite = 3
)
sourcepub const Append: OpenModeFlag = _
pub const Append: OpenModeFlag = _
The device is opened in append mode so that all data is written to the end of the file. (C++ enum variant: Append = 4
)
sourcepub const Truncate: OpenModeFlag = _
pub const Truncate: OpenModeFlag = _
If possible, the device is truncated before it is opened. All earlier contents of the device are lost. (C++ enum variant: Truncate = 8
)
sourcepub const Text: OpenModeFlag = _
pub const Text: OpenModeFlag = _
When reading, the end-of-line terminators are translated to ‘\n’. When writing, the end-of-line terminators are translated to the local encoding, for example ‘\r\n’ for Win32. (C++ enum variant: Text = 16
)
sourcepub const Unbuffered: OpenModeFlag = _
pub const Unbuffered: OpenModeFlag = _
Any buffer in the device is bypassed. (C++ enum variant: Unbuffered = 32
)
sourcepub const NewOnly: OpenModeFlag = _
pub const NewOnly: OpenModeFlag = _
Fail if the file to be opened already exists. Create and open the file only if it does not exist. There is a guarantee from the operating system that you are the only one creating and opening the file. Note that this mode implies WriteOnly, and combining it with ReadWrite is allowed. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may result in undefined behavior. (C++ enum variant: NewOnly = 64
)
sourcepub const ExistingOnly: OpenModeFlag = _
pub const ExistingOnly: OpenModeFlag = _
Fail if the file to be opened does not exist. This flag must be specified alongside ReadOnly, WriteOnly, or ReadWrite. Note that using this flag with ReadOnly alone is redundant, as ReadOnly already fails when the file does not exist. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may result in undefined behavior. (C++ enum variant: ExistingOnly = 128
)
Trait Implementations§
source§impl<T: Into<QFlags<OpenModeFlag>>> BitOr<T> for OpenModeFlag
impl<T: Into<QFlags<OpenModeFlag>>> BitOr<T> for OpenModeFlag
§type Output = QFlags<OpenModeFlag>
type Output = QFlags<OpenModeFlag>
|
operator.source§impl Clone for OpenModeFlag
impl Clone for OpenModeFlag
source§fn clone(&self) -> OpenModeFlag
fn clone(&self) -> OpenModeFlag
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OpenModeFlag
impl Debug for OpenModeFlag
source§impl From<OpenModeFlag> for QFlags<OpenModeFlag>
impl From<OpenModeFlag> for QFlags<OpenModeFlag>
source§fn from(value: OpenModeFlag) -> Self
fn from(value: OpenModeFlag) -> Self
source§impl From<OpenModeFlag> for c_int
impl From<OpenModeFlag> for c_int
source§fn from(value: OpenModeFlag) -> Self
fn from(value: OpenModeFlag) -> Self
source§impl From<i32> for OpenModeFlag
impl From<i32> for OpenModeFlag
source§impl PartialEq for OpenModeFlag
impl PartialEq for OpenModeFlag
source§fn eq(&self, other: &OpenModeFlag) -> bool
fn eq(&self, other: &OpenModeFlag) -> bool
self
and other
values to be equal, and is used
by ==
.