rename NativeFile -> NFile
This commit is contained in:
parent
7275e9a710
commit
8ffad3347f
@ -102,7 +102,7 @@ target_sources(nf7
|
|||||||
common/memento_recorder.hh
|
common/memento_recorder.hh
|
||||||
common/mutable_memento.hh
|
common/mutable_memento.hh
|
||||||
common/mutex.hh
|
common/mutex.hh
|
||||||
common/native_file.hh
|
common/nfile.hh
|
||||||
common/nfile_watcher.hh
|
common/nfile_watcher.hh
|
||||||
common/node.hh
|
common/node.hh
|
||||||
common/node_link_store.hh
|
common/node_link_store.hh
|
||||||
@ -127,8 +127,8 @@ target_sources(nf7
|
|||||||
common/yas_std_filesystem.hh
|
common/yas_std_filesystem.hh
|
||||||
common/yas_std_variant.hh
|
common/yas_std_variant.hh
|
||||||
|
|
||||||
$<$<PLATFORM_ID:Linux>:common/native_file_unix.cc>
|
$<$<PLATFORM_ID:Linux>:common/nfile_unix.cc>
|
||||||
$<$<PLATFORM_ID:Windows>:common/native_file_win.cc>
|
$<$<PLATFORM_ID:Windows>:common/nfile_win.cc>
|
||||||
|
|
||||||
file/audio_context.cc
|
file/audio_context.cc
|
||||||
file/audio_device.cc
|
file/audio_device.cc
|
||||||
@ -146,7 +146,7 @@ target_sources(nf7
|
|||||||
file/system_event.cc
|
file/system_event.cc
|
||||||
file/system_imgui.cc
|
file/system_imgui.cc
|
||||||
file/system_logger.cc
|
file/system_logger.cc
|
||||||
file/system_native_file.cc
|
file/system_nfile.cc
|
||||||
file/value_curve.cc
|
file/value_curve.cc
|
||||||
file/value_plot.cc
|
file/value_plot.cc
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace nf7 {
|
namespace nf7 {
|
||||||
|
|
||||||
class NativeFile final {
|
class NFile final {
|
||||||
public:
|
public:
|
||||||
class Exception final : public nf7::Exception {
|
class Exception final : public nf7::Exception {
|
||||||
using nf7::Exception::Exception;
|
using nf7::Exception::Exception;
|
||||||
@ -23,16 +23,16 @@ class NativeFile final {
|
|||||||
};
|
};
|
||||||
using Flags = uint8_t;
|
using Flags = uint8_t;
|
||||||
|
|
||||||
NativeFile() = delete;
|
NFile() = delete;
|
||||||
NativeFile(const std::filesystem::path& path, Flags flags) :
|
NFile(const std::filesystem::path& path, Flags flags) :
|
||||||
path_(path), flags_(flags) {
|
path_(path), flags_(flags) {
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
~NativeFile() noexcept;
|
~NFile() noexcept;
|
||||||
NativeFile(const NativeFile&) = delete;
|
NFile(const NFile&) = delete;
|
||||||
NativeFile(NativeFile&&) = delete;
|
NFile(NFile&&) = delete;
|
||||||
NativeFile& operator=(const NativeFile&) = delete;
|
NFile& operator=(const NFile&) = delete;
|
||||||
NativeFile& operator=(NativeFile&&) = delete;
|
NFile& operator=(NFile&&) = delete;
|
||||||
|
|
||||||
size_t Read(size_t offset, uint8_t* buf, size_t size);
|
size_t Read(size_t offset, uint8_t* buf, size_t size);
|
||||||
size_t Write(size_t offset, const uint8_t* buf, size_t size);
|
size_t Write(size_t offset, const uint8_t* buf, size_t size);
|
@ -1,4 +1,4 @@
|
|||||||
#include "common/native_file.hh"
|
#include "common/nfile.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -11,7 +11,7 @@ extern "C" {
|
|||||||
|
|
||||||
namespace nf7 {
|
namespace nf7 {
|
||||||
|
|
||||||
void NativeFile::Init() {
|
void NFile::Init() {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if ((flags_ & kRead) && (flags_ & kWrite)) {
|
if ((flags_ & kRead) && (flags_ & kWrite)) {
|
||||||
flags |= O_RDWR | O_CREAT;
|
flags |= O_RDWR | O_CREAT;
|
||||||
@ -23,45 +23,45 @@ void NativeFile::Init() {
|
|||||||
|
|
||||||
int fd = open(path_.string().c_str(), flags, 0600);
|
int fd = open(path_.string().c_str(), flags, 0600);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
throw NativeFile::Exception {"open failure"};
|
throw NFile::Exception {"open failure"};
|
||||||
}
|
}
|
||||||
handle_ = static_cast<uint64_t>(fd);
|
handle_ = static_cast<uint64_t>(fd);
|
||||||
}
|
}
|
||||||
NativeFile::~NativeFile() noexcept {
|
NFile::~NFile() noexcept {
|
||||||
const auto fd = static_cast<int>(handle_);
|
const auto fd = static_cast<int>(handle_);
|
||||||
if (close(fd) == -1) {
|
if (close(fd) == -1) {
|
||||||
// ;(
|
// ;(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NativeFile::Read(size_t offset, uint8_t* buf, size_t size) {
|
size_t NFile::Read(size_t offset, uint8_t* buf, size_t size) {
|
||||||
const auto fd = static_cast<int>(handle_);
|
const auto fd = static_cast<int>(handle_);
|
||||||
const auto off = static_cast<off_t>(offset);
|
const auto off = static_cast<off_t>(offset);
|
||||||
if (lseek(fd, off, SEEK_SET) == off-1) {
|
if (lseek(fd, off, SEEK_SET) == off-1) {
|
||||||
throw NativeFile::Exception {"lseek failure"};
|
throw NFile::Exception {"lseek failure"};
|
||||||
}
|
}
|
||||||
const auto ret = read(fd, buf, size);
|
const auto ret = read(fd, buf, size);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
throw NativeFile::Exception {"read failure"};
|
throw NFile::Exception {"read failure"};
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
size_t NativeFile::Write(size_t offset, const uint8_t* buf, size_t size) {
|
size_t NFile::Write(size_t offset, const uint8_t* buf, size_t size) {
|
||||||
const auto fd = static_cast<int>(handle_);
|
const auto fd = static_cast<int>(handle_);
|
||||||
const auto off = static_cast<off_t>(offset);
|
const auto off = static_cast<off_t>(offset);
|
||||||
if (lseek(fd, off, SEEK_SET) == off-1) {
|
if (lseek(fd, off, SEEK_SET) == off-1) {
|
||||||
throw nf7::NativeFile::Exception {"lseek failure"};
|
throw nf7::NFile::Exception {"lseek failure"};
|
||||||
}
|
}
|
||||||
const auto ret = write(fd, buf, size);
|
const auto ret = write(fd, buf, size);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
throw nf7::NativeFile::Exception {"write failure"};
|
throw nf7::NFile::Exception {"write failure"};
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
size_t NativeFile::Truncate(size_t size) {
|
size_t NFile::Truncate(size_t size) {
|
||||||
const auto fd = static_cast<int>(handle_);
|
const auto fd = static_cast<int>(handle_);
|
||||||
if (ftruncate(fd, static_cast<off_t>(size)) == 0) {
|
if (ftruncate(fd, static_cast<off_t>(size)) == 0) {
|
||||||
throw nf7::NativeFile::Exception {"ftruncate failure"};
|
throw nf7::NFile::Exception {"ftruncate failure"};
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
#include "common/native_file.hh"
|
#include "common/nfile.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -7,7 +7,7 @@ extern "C" {
|
|||||||
|
|
||||||
namespace nf7 {
|
namespace nf7 {
|
||||||
|
|
||||||
void NativeFile::Init() {
|
void NFile::Init() {
|
||||||
DWORD acc = 0;
|
DWORD acc = 0;
|
||||||
DWORD flags = 0;
|
DWORD flags = 0;
|
||||||
if (flags_ & kRead) {
|
if (flags_ & kRead) {
|
||||||
@ -24,55 +24,55 @@ void NativeFile::Init() {
|
|||||||
path_.string().c_str(),
|
path_.string().c_str(),
|
||||||
acc, 0, nullptr, flags, FILE_ATTRIBUTE_NORMAL, nullptr);
|
acc, 0, nullptr, flags, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
throw NativeFile::Exception {"open failure"};
|
throw NFile::Exception {"open failure"};
|
||||||
}
|
}
|
||||||
handle_ = reinterpret_cast<uintptr_t>(h);
|
handle_ = reinterpret_cast<uintptr_t>(h);
|
||||||
}
|
}
|
||||||
NativeFile::~NativeFile() noexcept {
|
NFile::~NFile() noexcept {
|
||||||
auto h = reinterpret_cast<HANDLE>(handle_);
|
auto h = reinterpret_cast<HANDLE>(handle_);
|
||||||
if (!CloseHandle(h)) {
|
if (!CloseHandle(h)) {
|
||||||
// ;(
|
// ;(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NativeFile::Read(size_t offset, uint8_t* buf, size_t size) {
|
size_t NFile::Read(size_t offset, uint8_t* buf, size_t size) {
|
||||||
const auto h = reinterpret_cast<HANDLE>(handle_);
|
const auto h = reinterpret_cast<HANDLE>(handle_);
|
||||||
|
|
||||||
LONG off_low = offset & 0xFFFFFFFF;
|
LONG off_low = offset & 0xFFFFFFFF;
|
||||||
LONG off_high = offset >> 32;
|
LONG off_high = offset >> 32;
|
||||||
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
||||||
throw NativeFile::Exception {"failed to set file pointer"};
|
throw NFile::Exception {"failed to set file pointer"};
|
||||||
}
|
}
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
if (!ReadFile(h, buf, static_cast<DWORD>(size), &ret, nullptr)) {
|
if (!ReadFile(h, buf, static_cast<DWORD>(size), &ret, nullptr)) {
|
||||||
throw NativeFile::Exception {"read failure"};
|
throw NFile::Exception {"read failure"};
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
size_t NativeFile::Write(size_t offset, const uint8_t* buf, size_t size) {
|
size_t NFile::Write(size_t offset, const uint8_t* buf, size_t size) {
|
||||||
const auto h = reinterpret_cast<HANDLE>(handle_);
|
const auto h = reinterpret_cast<HANDLE>(handle_);
|
||||||
|
|
||||||
LONG off_low = offset & 0xFFFFFFFF;
|
LONG off_low = offset & 0xFFFFFFFF;
|
||||||
LONG off_high = offset >> 32;
|
LONG off_high = offset >> 32;
|
||||||
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
||||||
throw NativeFile::Exception {"failed to set file pointer"};
|
throw NFile::Exception {"failed to set file pointer"};
|
||||||
}
|
}
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
if (!WriteFile(h, buf, static_cast<DWORD>(size), &ret, nullptr)) {
|
if (!WriteFile(h, buf, static_cast<DWORD>(size), &ret, nullptr)) {
|
||||||
throw NativeFile::Exception {"read failure"};
|
throw NFile::Exception {"read failure"};
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(ret);
|
return static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
size_t NativeFile::Truncate(size_t size) {
|
size_t NFile::Truncate(size_t size) {
|
||||||
const auto h = reinterpret_cast<HANDLE>(handle_);
|
const auto h = reinterpret_cast<HANDLE>(handle_);
|
||||||
|
|
||||||
LONG off_low = size & 0xFFFFFFFF;
|
LONG off_low = size & 0xFFFFFFFF;
|
||||||
LONG off_high = size >> 32;
|
LONG off_high = size >> 32;
|
||||||
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
if (INVALID_SET_FILE_POINTER == SetFilePointer(h, off_low, &off_high, FILE_BEGIN)) {
|
||||||
throw NativeFile::Exception {"failed to set file pointer"};
|
throw NFile::Exception {"failed to set file pointer"};
|
||||||
}
|
}
|
||||||
if (!SetEndOfFile(h)) {
|
if (!SetEndOfFile(h)) {
|
||||||
throw NativeFile::Exception {"SetEndOfFile failure"};
|
throw NFile::Exception {"SetEndOfFile failure"};
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
@ -23,7 +23,7 @@
|
|||||||
#include "common/life.hh"
|
#include "common/life.hh"
|
||||||
#include "common/logger_ref.hh"
|
#include "common/logger_ref.hh"
|
||||||
#include "common/mutex.hh"
|
#include "common/mutex.hh"
|
||||||
#include "common/native_file.hh"
|
#include "common/nfile.hh"
|
||||||
#include "common/node.hh"
|
#include "common/node.hh"
|
||||||
#include "common/ptr_selector.hh"
|
#include "common/ptr_selector.hh"
|
||||||
#include "common/thread.hh"
|
#include "common/thread.hh"
|
||||||
@ -33,11 +33,11 @@
|
|||||||
namespace nf7 {
|
namespace nf7 {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class NativeFile final : public nf7::FileBase,
|
class NFile final : public nf7::FileBase,
|
||||||
public nf7::DirItem, public nf7::Node {
|
public nf7::DirItem, public nf7::Node {
|
||||||
public:
|
public:
|
||||||
static inline const nf7::GenericTypeInfo<NativeFile> kType = {
|
static inline const nf7::GenericTypeInfo<NFile> kType = {
|
||||||
"System/NativeFile", {"nf7::DirItem", "nf7::Node"}};
|
"System/NFile", {"nf7::DirItem", "nf7::Node"}};
|
||||||
static void UpdateTypeTooltip() noexcept {
|
static void UpdateTypeTooltip() noexcept {
|
||||||
ImGui::TextUnformatted("Read/Write a file placed on native filesystem.");
|
ImGui::TextUnformatted("Read/Write a file placed on native filesystem.");
|
||||||
ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node");
|
ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node");
|
||||||
@ -46,11 +46,11 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
class Lambda;
|
class Lambda;
|
||||||
|
|
||||||
struct SharedData final {
|
struct SharedData final {
|
||||||
SharedData(NativeFile& f) noexcept : log(f) {
|
SharedData(NFile& f) noexcept : log(f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nf7::LoggerRef log;
|
nf7::LoggerRef log;
|
||||||
std::optional<nf7::NativeFile> nfile;
|
std::optional<nf7::NFile> nfile;
|
||||||
};
|
};
|
||||||
struct Runner final {
|
struct Runner final {
|
||||||
struct Task {
|
struct Task {
|
||||||
@ -85,7 +85,7 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
std::string mode;
|
std::string mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeFile(nf7::Env& env, Data&& data = {}) noexcept :
|
NFile(nf7::Env& env, Data&& data = {}) noexcept :
|
||||||
nf7::FileBase(kType, env, {&config_popup_}),
|
nf7::FileBase(kType, env, {&config_popup_}),
|
||||||
nf7::DirItem(nf7::DirItem::kMenu |
|
nf7::DirItem(nf7::DirItem::kMenu |
|
||||||
nf7::DirItem::kTooltip |
|
nf7::DirItem::kTooltip |
|
||||||
@ -102,14 +102,14 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
mtx_.onUnlock = [this]() { shared_->nfile.reset(); };
|
mtx_.onUnlock = [this]() { shared_->nfile.reset(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeFile(nf7::Deserializer& ar) : NativeFile(ar.env()) {
|
NFile(nf7::Deserializer& ar) : NFile(ar.env()) {
|
||||||
ar(data().npath, data().mode);
|
ar(data().npath, data().mode);
|
||||||
}
|
}
|
||||||
void Serialize(nf7::Serializer& ar) const noexcept override {
|
void Serialize(nf7::Serializer& ar) const noexcept override {
|
||||||
ar(data().npath, data().mode);
|
ar(data().npath, data().mode);
|
||||||
}
|
}
|
||||||
std::unique_ptr<nf7::File> Clone(nf7::Env& env) const noexcept override {
|
std::unique_ptr<nf7::File> Clone(nf7::Env& env) const noexcept override {
|
||||||
return std::make_unique<NativeFile>(env, Data {data()});
|
return std::make_unique<NFile>(env, Data {data()});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<nf7::Node::Lambda> CreateLambda(
|
std::shared_ptr<nf7::Node::Lambda> CreateLambda(
|
||||||
@ -134,7 +134,7 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nf7::Life<NativeFile> life_;
|
nf7::Life<NFile> life_;
|
||||||
|
|
||||||
std::shared_ptr<SharedData> shared_;
|
std::shared_ptr<SharedData> shared_;
|
||||||
std::shared_ptr<Thread> th_;
|
std::shared_ptr<Thread> th_;
|
||||||
@ -152,7 +152,7 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
struct ConfigPopup final :
|
struct ConfigPopup final :
|
||||||
public nf7::FileBase::Feature, private nf7::gui::Popup {
|
public nf7::FileBase::Feature, private nf7::gui::Popup {
|
||||||
public:
|
public:
|
||||||
ConfigPopup(NativeFile& f) noexcept :
|
ConfigPopup(NFile& f) noexcept :
|
||||||
nf7::gui::Popup("ConfigPopup"), f_(&f) {
|
nf7::gui::Popup("ConfigPopup"), f_(&f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
void Update() noexcept override;
|
void Update() noexcept override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NativeFile* const f_;
|
NFile* const f_;
|
||||||
|
|
||||||
std::string npath_;
|
std::string npath_;
|
||||||
bool read_, write_;
|
bool read_, write_;
|
||||||
@ -176,9 +176,9 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
|
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
const auto& mode = data().mode;
|
const auto& mode = data().mode;
|
||||||
nf7::NativeFile::Flags flags = 0;
|
nf7::NFile::Flags flags = 0;
|
||||||
if (std::string::npos != mode.find('r')) flags |= nf7::NativeFile::kRead;
|
if (std::string::npos != mode.find('r')) flags |= nf7::NFile::kRead;
|
||||||
if (std::string::npos != mode.find('w')) flags |= nf7::NativeFile::kWrite;
|
if (std::string::npos != mode.find('w')) flags |= nf7::NFile::kWrite;
|
||||||
|
|
||||||
auto ctx = std::make_shared<nf7::GenericContext>(*this);
|
auto ctx = std::make_shared<nf7::GenericContext>(*this);
|
||||||
th_->Push(ctx, Runner::Task {
|
th_->Push(ctx, Runner::Task {
|
||||||
@ -192,10 +192,10 @@ class NativeFile final : public nf7::FileBase,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class NativeFile::Lambda final : public nf7::Node::Lambda,
|
class NFile::Lambda final : public nf7::Node::Lambda,
|
||||||
public std::enable_shared_from_this<NativeFile::Lambda> {
|
public std::enable_shared_from_this<NFile::Lambda> {
|
||||||
public:
|
public:
|
||||||
Lambda(NativeFile& f, const std::shared_ptr<nf7::Node::Lambda>& parent) noexcept :
|
Lambda(NFile& f, const std::shared_ptr<nf7::Node::Lambda>& parent) noexcept :
|
||||||
nf7::Node::Lambda(f, parent), f_(f.life_), shared_(f.shared_) {
|
nf7::Node::Lambda(f, parent), f_(f.life_), shared_(f.shared_) {
|
||||||
}
|
}
|
||||||
~Lambda() noexcept {
|
~Lambda() noexcept {
|
||||||
@ -244,7 +244,7 @@ class NativeFile::Lambda final : public nf7::Node::Lambda,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nf7::Life<NativeFile>::Ref f_;
|
nf7::Life<NFile>::Ref f_;
|
||||||
|
|
||||||
std::shared_ptr<SharedData> shared_;
|
std::shared_ptr<SharedData> shared_;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ class NativeFile::Lambda final : public nf7::Node::Lambda,
|
|||||||
auto self = shared_from_this();
|
auto self = shared_from_this();
|
||||||
lock_->Then([self, this, caller, f = std::move(f)](auto fu) mutable {
|
lock_->Then([self, this, caller, f = std::move(f)](auto fu) mutable {
|
||||||
const auto k = fu.value();
|
const auto k = fu.value();
|
||||||
f_->th_->Push(self, NativeFile::Runner::Task {
|
f_->th_->Push(self, NFile::Runner::Task {
|
||||||
.callee = self,
|
.callee = self,
|
||||||
.caller = std::move(caller),
|
.caller = std::move(caller),
|
||||||
.func = std::move(f),
|
.func = std::move(f),
|
||||||
@ -266,13 +266,13 @@ class NativeFile::Lambda final : public nf7::Node::Lambda,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::shared_ptr<nf7::Node::Lambda> NativeFile::CreateLambda(
|
std::shared_ptr<nf7::Node::Lambda> NFile::CreateLambda(
|
||||||
const std::shared_ptr<nf7::Node::Lambda>& parent) noexcept {
|
const std::shared_ptr<nf7::Node::Lambda>& parent) noexcept {
|
||||||
return std::make_shared<NativeFile::Lambda>(*this, parent);
|
return std::make_shared<NFile::Lambda>(*this, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NativeFile::Update() noexcept {
|
void NFile::Update() noexcept {
|
||||||
nf7::FileBase::Update();
|
nf7::FileBase::Update();
|
||||||
|
|
||||||
// file update check
|
// file update check
|
||||||
@ -285,24 +285,24 @@ void NativeFile::Update() noexcept {
|
|||||||
} catch (std::filesystem::filesystem_error&) {
|
} catch (std::filesystem::filesystem_error&) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void NativeFile::UpdateMenu() noexcept {
|
void NFile::UpdateMenu() noexcept {
|
||||||
if (ImGui::MenuItem("config")) {
|
if (ImGui::MenuItem("config")) {
|
||||||
config_popup_.Open();
|
config_popup_.Open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void NativeFile::UpdateTooltip() noexcept {
|
void NFile::UpdateTooltip() noexcept {
|
||||||
ImGui::Text("npath: %s", data().npath.generic_string().c_str());
|
ImGui::Text("npath: %s", data().npath.generic_string().c_str());
|
||||||
ImGui::Text("mode : %s", data().mode.c_str());
|
ImGui::Text("mode : %s", data().mode.c_str());
|
||||||
}
|
}
|
||||||
void NativeFile::UpdateWidget() noexcept {
|
void NFile::UpdateWidget() noexcept {
|
||||||
ImGui::TextUnformatted("System/NativeFile");
|
ImGui::TextUnformatted("System/NFile");
|
||||||
|
|
||||||
if (ImGui::Button("config")) {
|
if (ImGui::Button("config")) {
|
||||||
config_popup_.Open();
|
config_popup_.Open();
|
||||||
}
|
}
|
||||||
config_popup_.Update();
|
config_popup_.Update();
|
||||||
}
|
}
|
||||||
void NativeFile::ConfigPopup::Update() noexcept {
|
void NFile::ConfigPopup::Update() noexcept {
|
||||||
if (nf7::gui::Popup::Begin()) {
|
if (nf7::gui::Popup::Begin()) {
|
||||||
ImGui::InputText("path", &npath_);
|
ImGui::InputText("path", &npath_);
|
||||||
ImGui::Checkbox("read", &read_);
|
ImGui::Checkbox("read", &read_);
|
Loading…
x
Reference in New Issue
Block a user