RASCSI/cpp/rasctl/rasctl_display.h

47 lines
1.6 KiB
C
Raw Normal View History

//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI Reloaded
// for Raspberry Pi
//
Fix simple SonarCloud issues (#834) * Fixing SonarCloud issues, first round * Fixing SonarCLoud issues, next round * Fixing SonarQube issues, next round * Fixed warning * Replaced empty constructors/destructors with = default; * Fixed warning * Replaced new * Use constants instead of macros * Use structured binding declarations * Use init statements for if * Use string views * Use enum class, use using instead of typedef * Fixed more SonarCloud warnings * Replaced redundant/duplicate types with auto * Devlared methods const * Memory management update * Fixed warning * Added missing const * Improved RaScsiResponse memory management * Improved memory management * Improved memory management * Replaced macros by constants, removed unused constants * Made member private * Fixed warning * Added comment * Fixed shadowing warnings * Cleanup * Cleanup * Cleanup * Fixed shadowing warning * Removed unused code * Fixed more warnings * Removed obsolete casts * Fixed warnings * Removed unused field * Removed library not needed by rasctl * Include cleanup * Updated platform check for better compatibility * Improved check for invalid option. This prevents rasctl to break on macos. * Updated option check * Fixed typo * Added TODO * Removed macro * Scope update * Replaced macro * Added TODO, update memory management * Fixed typo * Replaced NULL by nullptr * Use more structured bindings * Added TODO * Use calloc instead of mallco to not need memset * Fixed warnings * Fixed SonarQube initialization issues * Fixed warning * Cleaned up override/virtual/final * Fixed warnings * Constructor update * Fixed tests * Improved memory management * Added missing const * Added const * Fixed two bugs reported by SonarCloud * Fix SonarCloud hotspot * Fixed memory management * Memory management update * Addressing hotspot by using strncpy * Fixed SonarCloud issues * Fixed SonarQube issues * Added missing const * Added const * Added const * Suppress false positive * Added SonarQube suppressions for false positives * Added suppresoin * Fixed code smells * Reverted changes that is a SonarQube issue, but caused problems with -O3 * Removed TODO based on review
2022-09-07 14:38:42 +00:00
// Copyright (C) 2021-2022 Uwe Seimet
//
//---------------------------------------------------------------------------
#pragma once
#include "rascsi_interface.pb.h"
#include <string>
#include <sstream>
using namespace std;
using namespace rascsi_interface;
class RasctlDisplay
{
public:
Fix simple SonarCloud issues (#834) * Fixing SonarCloud issues, first round * Fixing SonarCLoud issues, next round * Fixing SonarQube issues, next round * Fixed warning * Replaced empty constructors/destructors with = default; * Fixed warning * Replaced new * Use constants instead of macros * Use structured binding declarations * Use init statements for if * Use string views * Use enum class, use using instead of typedef * Fixed more SonarCloud warnings * Replaced redundant/duplicate types with auto * Devlared methods const * Memory management update * Fixed warning * Added missing const * Improved RaScsiResponse memory management * Improved memory management * Improved memory management * Replaced macros by constants, removed unused constants * Made member private * Fixed warning * Added comment * Fixed shadowing warnings * Cleanup * Cleanup * Cleanup * Fixed shadowing warning * Removed unused code * Fixed more warnings * Removed obsolete casts * Fixed warnings * Removed unused field * Removed library not needed by rasctl * Include cleanup * Updated platform check for better compatibility * Improved check for invalid option. This prevents rasctl to break on macos. * Updated option check * Fixed typo * Added TODO * Removed macro * Scope update * Replaced macro * Added TODO, update memory management * Fixed typo * Replaced NULL by nullptr * Use more structured bindings * Added TODO * Use calloc instead of mallco to not need memset * Fixed warnings * Fixed SonarQube initialization issues * Fixed warning * Cleaned up override/virtual/final * Fixed warnings * Constructor update * Fixed tests * Improved memory management * Added missing const * Added const * Fixed two bugs reported by SonarCloud * Fix SonarCloud hotspot * Fixed memory management * Memory management update * Addressing hotspot by using strncpy * Fixed SonarCloud issues * Fixed SonarQube issues * Added missing const * Added const * Added const * Suppress false positive * Added SonarQube suppressions for false positives * Added suppresoin * Fixed code smells * Reverted changes that is a SonarQube issue, but caused problems with -O3 * Removed TODO based on review
2022-09-07 14:38:42 +00:00
RasctlDisplay() = default;
~RasctlDisplay() = default;
string DisplayDevicesInfo(const PbDevicesInfo&) const;
string DisplayDeviceInfo(const PbDevice&) const;
string DisplayVersionInfo(const PbVersionInfo&) const;
string DisplayLogLevelInfo(const PbLogLevelInfo&) const;
string DisplayDeviceTypesInfo(const PbDeviceTypesInfo&) const;
string DisplayReservedIdsInfo(const PbReservedIdsInfo&) const;
string DisplayImageFile(const PbImageFile&) const;
string DisplayImageFilesInfo(const PbImageFilesInfo&) const;
string DisplayNetworkInterfaces(const PbNetworkInterfacesInfo&) const;
string DisplayMappingInfo(const PbMappingInfo&) const;
string DisplayOperationInfo(const PbOperationInfo&) const;
private:
void DisplayParams(ostringstream&, const PbDevice&) const;
void DisplayAttributes(ostringstream&, const PbDeviceProperties&) const;
void DisplayDefaultParameters(ostringstream&, const PbDeviceProperties&) const;
void DisplayBlockSizes(ostringstream&, const PbDeviceProperties&) const;
void DisplayParameters(ostringstream&, const PbOperationMetaData&) const;
void DisplayPermittedValues(ostringstream&, const PbOperationParameter&) const;
};