Skip to content

Commit

Permalink
Merge branch 'FreeCAD:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rostskadat authored Feb 21, 2024
2 parents db0719f + 260daaf commit c82063e
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/App/StringHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void StringHasher::RestoreDocFile(Base::Reader& reader)

void StringHasher::restoreStreamNew(std::istream& stream, std::size_t count)
{
Base::ASCIIInputStream asciiStream (stream);
Base::TextInputStream asciiStream (stream);
_hashes->clear();
std::string content;
boost::io::ios_flags_saver ifs(stream);
Expand Down
2 changes: 1 addition & 1 deletion src/Base/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ std::streambuf::pos_type Streambuf::seekpos(std::streambuf::pos_type pos,
// The custom string handler written by realthunder for the LinkStage3 toponaming code, to handle
// reading multi-line strings directly into a std::string. Imported from LinkStage3 and refactored
// during the TNP mitigation project in February 2024.
ASCIIInputStream& ASCIIInputStream::operator>>(std::string& outputString)
TextInputStream& TextInputStream::operator>>(std::string& outputString)
{
uint32_t numberOfLines;
char inputChar;
Expand Down
42 changes: 21 additions & 21 deletions src/Base/Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,104 +142,104 @@ class BaseExport InputStream: public Stream
};

/**
* The ASCIIInputStream class provides reading of ASCII data from an istream, with custom handling
* The TextInputStream class provides reading of ASCII data from an istream, with custom handling
* for std::string to make it easier to read a single multi-line (or multi-word) string. This is
* designed for easy compatibility with the LinkStage3 implementation of the InputStream class, used
* to store StringHashers for the toponaming mitigation technique.
*/
class BaseExport ASCIIInputStream: public Stream
class BaseExport TextInputStream: public Stream
{
public:
/** Constructor
* @param rin: upstream input
*/
explicit ASCIIInputStream(std::istream& rin)
explicit TextInputStream(std::istream& rin)
: _in(rin)
{}

ASCIIInputStream(const ASCIIInputStream&) = delete;
TextInputStream(const TextInputStream&) = delete;

ASCIIInputStream(const ASCIIInputStream&&) noexcept = delete;
TextInputStream(const TextInputStream&&) noexcept = delete;

void operator=(const ASCIIInputStream&) = delete;
void operator=(const TextInputStream&) = delete;

void operator=(const ASCIIInputStream&&) = delete;
void operator=(const TextInputStream&&) = delete;

~ASCIIInputStream() override = default;
~TextInputStream() override = default;

ASCIIInputStream& operator>>(bool& input)
TextInputStream& operator>>(bool& input)
{
_in >> input;
return *this;
}

ASCIIInputStream& operator>>(int8_t& ch)
TextInputStream& operator>>(int8_t& ch)
{
int index {};
_in >> index;
ch = (int8_t)index;
return *this;
}

ASCIIInputStream& operator>>(uint8_t& uch)
TextInputStream& operator>>(uint8_t& uch)
{
unsigned uns {};
_in >> uns;
uch = (uint8_t)uns;
return *this;
}

ASCIIInputStream& operator>>(int16_t& int16)
TextInputStream& operator>>(int16_t& int16)
{
_in >> int16;
return *this;
}

ASCIIInputStream& operator>>(uint16_t& us)
TextInputStream& operator>>(uint16_t& us)
{
_in >> us;
return *this;
}

ASCIIInputStream& operator>>(int32_t& int32)
TextInputStream& operator>>(int32_t& int32)
{
_in >> int32;
return *this;
}

ASCIIInputStream& operator>>(uint32_t& ui)
TextInputStream& operator>>(uint32_t& ui)
{
_in >> ui;
return *this;
}

ASCIIInputStream& operator>>(int64_t& int64)
TextInputStream& operator>>(int64_t& int64)
{
_in >> int64;
return *this;
}

ASCIIInputStream& operator>>(uint64_t& ul)
TextInputStream& operator>>(uint64_t& ul)
{
_in >> ul;
return *this;
}

ASCIIInputStream& operator>>(float& flt)
TextInputStream& operator>>(float& flt)
{
_in >> flt;
return *this;
}

ASCIIInputStream& operator>>(double& dbl)
TextInputStream& operator>>(double& dbl)
{
_in >> dbl;
return *this;
}

ASCIIInputStream& operator>>(std::string& str);
TextInputStream& operator>>(std::string& str);

ASCIIInputStream& operator>>(char& chr)
TextInputStream& operator>>(char& chr)
{
chr = (char)_in.get();
return *this;
Expand Down
2 changes: 0 additions & 2 deletions src/Gui/PythonWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ constexpr auto &SbkPySide_QtGuiTypes = SbkPySide2_QtGuiTypes;
constexpr auto &SbkPySide_QtWidgetsTypes = SbkPySide2_QtWidgetsTypes;
constexpr auto &SbkPySide_QtPrintSupportTypes = SbkPySide2_QtPrintSupportTypes;
constexpr auto &SbkPySide_QtUiToolsTypes = SbkPySide2_QtUiToolsTypes;
constexpr const char* ModuleShiboken = "shiboken2";
constexpr const char* ModulePySide = "PySide2";
#else
PyTypeObject** SbkPySide6_QtCoreTypes = nullptr;
Expand All @@ -170,7 +169,6 @@ constexpr auto &SbkPySide_QtGuiTypes = SbkPySide6_QtGuiTypes;
constexpr auto &SbkPySide_QtWidgetsTypes = SbkPySide6_QtWidgetsTypes;
constexpr auto &SbkPySide_QtPrintSupportTypes = SbkPySide6_QtPrintSupportTypes;
constexpr auto &SbkPySide_QtUiToolsTypes = SbkPySide6_QtUiToolsTypes;
constexpr const char* ModuleShiboken = "shiboken6";
constexpr const char* ModulePySide = "PySide6";
#endif
#else
Expand Down
4 changes: 4 additions & 0 deletions src/Gui/propertyeditor/PropertyEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,11 @@ bool PropertyEditor::eventFilter(QObject* object, QEvent* event) {
else if (mouse_event->type() == QEvent::MouseButtonPress && mouse_event->button() == Qt::LeftButton && !dragInProgress) {
if (indexResizable(mouse_event->pos()).isValid()) {
dragInProgress = true;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
dragPreviousPos = mouse_event->x();
#else
dragPreviousPos = mouse_event->position().toPoint().x();
#endif
dragSection = indexResizable(mouse_event->pos()).column();
return true;
}
Expand Down
Loading

0 comments on commit c82063e

Please sign in to comment.