Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX coding error #28

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions mdflibrary/MdfAttachment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Int64 MdfAttachment::Index::get() {
return attachment_ != nullptr ? attachment_->Index() : 0;
}

unsigned short MdfAttachment::CreatorIndex::get() {
UInt16 MdfAttachment::CreatorIndex::get() {
return attachment_ != nullptr ? attachment_->CreatorIndex() : 0;
}

void MdfAttachment::CreatorIndex::set(unsigned short index) {
void MdfAttachment::CreatorIndex::set(UInt16 index) {
if (attachment_ != nullptr) {
attachment_->CreatorIndex(index);
}
Expand Down Expand Up @@ -56,8 +56,8 @@ String^ MdfAttachment::Md5::get() {
}

return attachment_->Md5().has_value()
? MdfLibrary::Utf8Conversion(
attachment_->Md5().value()) : gcnew String("");
? MdfLibrary::Utf8Conversion(attachment_->Md5().value())
: gcnew String("");
}

String^ MdfAttachment::FileName::get() {
Expand All @@ -66,10 +66,8 @@ String^ MdfAttachment::FileName::get() {
}

void MdfAttachment::FileName::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (attachment_ != nullptr) {
attachment_->FileName(temp);
attachment_->FileName(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -79,10 +77,8 @@ String^ MdfAttachment::FileType::get() {
}

void MdfAttachment::FileType::set(String^ type) {
const auto temp = String::IsNullOrEmpty(type) ?
std::string() : marshal_as<std::string>(type);
if (attachment_ != nullptr) {
attachment_->FileType(temp);
attachment_->FileType(MdfLibrary::Utf8Conversion(type));
}
}

Expand Down
24 changes: 7 additions & 17 deletions mdflibrary/MdfChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ String^ MdfChannel::Name::get() {
}

void MdfChannel::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ? std::string()
: marshal_as<std::string>(name);
if (channel_ != nullptr) {
channel_->Name(temp);
channel_->Name(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -35,10 +33,8 @@ String^ MdfChannel::DisplayName::get() {
}

void MdfChannel::DisplayName::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ? std::string()
: marshal_as<std::string>(name);
if (channel_ != nullptr) {
channel_->DisplayName(temp);
channel_->DisplayName(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -49,10 +45,8 @@ String^ MdfChannel::Description::get() {
}

void MdfChannel::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ? std::string()
: marshal_as<std::string>(desc);
if (channel_ != nullptr) {
channel_->Description(temp);
channel_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand All @@ -66,10 +60,8 @@ String^ MdfChannel::Unit::get() {
}

void MdfChannel::Unit::set(String^ unit) {
const auto temp = String::IsNullOrEmpty(unit) ? std::string()
: marshal_as<std::string>(unit);
if (channel_ != nullptr) {
channel_->Unit(temp);
channel_->Unit(MdfLibrary::Utf8Conversion(unit));
}
}

Expand Down Expand Up @@ -110,7 +102,7 @@ void MdfChannel::DataType::set(ChannelDataType type) {
}

CnFlag MdfChannel::Flags::get() {
auto temp = channel_ == nullptr ? static_cast<CnFlag>(channel_->Flags()) : CnFlag::None;
auto temp = channel_ != nullptr ? static_cast<CnFlag>(channel_->Flags()) : CnFlag::None;
return temp;
}

Expand Down Expand Up @@ -268,10 +260,8 @@ void MdfChannel::SetChannelValue(const double value, bool valid) {
}

void MdfChannel::SetChannelValue(String^ value, bool valid) {
const auto temp = String::IsNullOrEmpty(value)
? std::string()
: marshal_as<std::string>(value);
if (channel_ != nullptr) channel_->SetChannelValue(temp, valid);
if (channel_ != nullptr)
channel_->SetChannelValue(MdfLibrary::Utf8Conversion(value), valid);
}

void MdfChannel::SetChannelValue(array<Byte>^ value, bool valid) {
Expand Down
12 changes: 3 additions & 9 deletions mdflibrary/MdfChannelConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ String^ MdfChannelConversion::Name::get() {
}

void MdfChannelConversion::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (conversion_ != nullptr) {
conversion_->Name(temp);
conversion_->Name(MdfLibrary::Utf8Conversion(name));
}
}

String^ MdfChannelConversion::Description::get() {
return conversion_ != nullptr ? MdfLibrary::Utf8Conversion(conversion_->Description()) : gcnew String("");
}
void MdfChannelConversion::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ?
std::string() : marshal_as<std::string>(desc);
if (conversion_ != nullptr) {
conversion_->Description(temp);
conversion_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand All @@ -48,10 +44,8 @@ String^ MdfChannelConversion::Unit::get() {
}

void MdfChannelConversion::Unit::set(String^ unit) {
const auto temp = String::IsNullOrEmpty(unit) ?
std::string() : marshal_as<std::string>(unit);
if (conversion_ != nullptr) {
conversion_->Unit(temp);
conversion_->Unit(MdfLibrary::Utf8Conversion(unit));
}
}

Expand Down
8 changes: 2 additions & 6 deletions mdflibrary/MdfChannelGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ String^ MdfChannelGroup::Name::get() {
}

void MdfChannelGroup::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (group_ != nullptr) {
group_->Name(temp);
group_->Name(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -42,10 +40,8 @@ String^ MdfChannelGroup::Description::get() {
}

void MdfChannelGroup::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ?
std::string() : marshal_as<std::string>(desc);
if (group_ != nullptr) {
group_->Description(temp);
group_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand Down
4 changes: 1 addition & 3 deletions mdflibrary/MdfDataGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ String^ MdfDataGroup::Description::get() {
}

void MdfDataGroup::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ?
std::string() : marshal_as<std::string>(desc);
if (group_ != nullptr) {
group_->Description(temp);
group_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand Down
28 changes: 7 additions & 21 deletions mdflibrary/MdfETag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ String^ MdfETag::Name::get() {
}

void MdfETag::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (tag_ != nullptr) {
tag_->Name(temp);
tag_->Name(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -41,10 +39,8 @@ String^ MdfETag::Description::get() {
}

void MdfETag::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ?
std::string() : marshal_as<std::string>(desc);
if (tag_ != nullptr) {
tag_->Description(temp);
tag_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand All @@ -53,10 +49,8 @@ String^ MdfETag::Unit::get() {
}

void MdfETag::Unit::set(String^ unit) {
const auto temp = String::IsNullOrEmpty(unit) ?
std::string() : marshal_as<std::string>(unit);
if (tag_ != nullptr) {
tag_->Unit(temp);
tag_->Unit(MdfLibrary::Utf8Conversion(unit));
}
}

Expand All @@ -65,10 +59,8 @@ String^ MdfETag::UnitRef::get() {
}

void MdfETag::UnitRef::set(String^ unit) {
const auto temp = String::IsNullOrEmpty(unit) ?
std::string() : marshal_as<std::string>(unit);
if (tag_ != nullptr) {
tag_->UnitRef(temp);
tag_->UnitRef(MdfLibrary::Utf8Conversion(unit));
}
}

Expand All @@ -77,10 +69,8 @@ String^ MdfETag::Type::get() {
}

void MdfETag::Type::set(String^ type) {
const auto temp = String::IsNullOrEmpty(type) ?
std::string() : marshal_as<std::string>(type);
if (tag_ != nullptr) {
tag_->Type(temp);
tag_->Type(MdfLibrary::Utf8Conversion(type));
}
}

Expand All @@ -100,10 +90,8 @@ String^ MdfETag::Language::get() {
}

void MdfETag::Language::set(String^ language) {
const auto temp = String::IsNullOrEmpty(language) ?
std::string() : marshal_as<std::string>(language);
if (tag_ != nullptr) {
tag_->Language(temp);
tag_->Language(MdfLibrary::Utf8Conversion(language));
}
}

Expand All @@ -122,10 +110,8 @@ String^ MdfETag::ValueAsString::get() {
}

void MdfETag::ValueAsString::set(String^ value) {
const auto temp = String::IsNullOrEmpty(value) ?
std::string() : marshal_as<std::string>(value);
if (tag_ != nullptr) {
tag_->Value(temp);
tag_->Value(MdfLibrary::Utf8Conversion(value));
}
}

Expand Down
15 changes: 4 additions & 11 deletions mdflibrary/MdfEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ String^ MdfEvent::Name::get() {
}

void MdfEvent::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (event_ != nullptr) {
event_->Name(temp);
event_->Name(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -33,10 +31,8 @@ String^ MdfEvent::Description::get() {
}

void MdfEvent::Description::set(String^ desc) {
const auto temp = String::IsNullOrEmpty(desc) ?
std::string() : marshal_as<std::string>(desc);
if (event_ != nullptr) {
event_->Description(temp);
event_->Description(MdfLibrary::Utf8Conversion(desc));
}
}

Expand All @@ -45,11 +41,8 @@ String ^ MdfEvent::GroupName::get() {
}

void MdfEvent::GroupName::set(String ^ group_name) {
const auto temp = String::IsNullOrEmpty(group_name)
? std::string()
: marshal_as<std::string>(group_name);
if (event_ != nullptr) {
event_->GroupName(temp);
if (event_ != nullptr) {
event_->GroupName(MdfLibrary::Utf8Conversion(group_name));
}
}

Expand Down
12 changes: 3 additions & 9 deletions mdflibrary/MdfFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ String^ MdfFile::Name::get() {
}

void MdfFile::Name::set(String^ name) {
const auto temp = String::IsNullOrEmpty(name) ?
std::string() : marshal_as<std::string>(name);
if (mdf_file_ != nullptr) {
mdf_file_->Name(temp);
mdf_file_->Name(MdfLibrary::Utf8Conversion(name));
}
}

Expand All @@ -59,10 +57,8 @@ String^ MdfFile::Filename::get() {
}

void MdfFile::Filename::set(String^ filename) {
const auto temp = String::IsNullOrEmpty(filename) ?
std::string() : marshal_as<std::string>(filename);
if (mdf_file_ != nullptr) {
mdf_file_->FileName(temp);
mdf_file_->FileName(MdfLibrary::Utf8Conversion(filename));
}
}

Expand Down Expand Up @@ -90,10 +86,8 @@ String^ MdfFile::ProgramId::get() {
}

void MdfFile::ProgramId::set(String^ program_id) {
const auto temp = String::IsNullOrEmpty(program_id) ?
std::string() : marshal_as<std::string>(program_id);
if (mdf_file_ != nullptr) {
mdf_file_->ProgramId(temp);
mdf_file_->ProgramId(MdfLibrary::Utf8Conversion(program_id));
}
}

Expand Down
Loading
Loading