Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-26Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
Use function style casts in C++ headers & source.
2022-09-25Cleanup: follow C++ type cast style guide in some filesJacques Lucke
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-07Cleanup: clang-formatCampbell Barton
2022-02-04BLI: use methods specialized for finding a single char in StringRefAras Pranckevicius
Previously, these methods used the more generic substring-finding algorithm, which is more complex and slower. Using the more specialized methods results in a noticable speedup in the obj importer (D13958). Differential Revision: https://developer.blender.org/D14012
2022-01-26BLI_string_ref: Add back missing rfind()Clément Foucault
Must have been removed in a bad merge or something.
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2021-11-02BLI: avoid passing nullptr to strncmpJacques Lucke
This resulted in an ASAN warning.
2021-10-24Cleanup: spelling in commentsCampbell Barton
2021-10-05Cleanup: use doxygen sectionsCampbell Barton
2021-10-03Cleanup: move StringRef method definitions out of classJacques Lucke
This makes the classes more appealing to look at and makes it easier to see what different methods are available.
2021-09-22BLI: avoid warning when copying empty StringRefJacques Lucke
2021-07-27Add `StringRef::trim()` functionsSybren A. Stüvel
Add three functions that trim characters from the front & end of a `StringRef`. All functions return a new `StringRef` that references a sub-string of the original `StringRef`. - `trim(chars_to_remove)`: strips all characters from the start and end that occur in `chars_to_remove`. - `trim(char_to_remove)`: same, but with a single character to remove. - `trim()`: remove leading & trailing whitespace, so same as `trim(" \r\n\t")` Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D12031
2021-02-21BLI: cleanup StringRef and Span and improve parameter validationJacques Lucke
Previously, methods like `Span.drop_front` would crash when more elements would be dropped than are available. While this is most efficient, it is not very practical in some use cases. Also other languages silently clamp the index, so one can easily write wrong code accidentally. Now, `Span.drop_front` and similar methods will only crash when n is negative. Too large values will be clamped down to their maximum possible value. While this is slightly less efficient, I did not have a case where this actually mattered yet. If it does matter in the future, we can add a separate `*_unchecked` method. This should not change the behavior of existing code.
2020-12-16BLI: constexpr Span, IndexRange, StringRef(Null/Base)Ankit Meel
Motivated by `std::string_view` being usable in const (compile-time) context. One functional change was needed for StringRef: `std::char_traits<char>::length(str)` instead of `strlen`. Reviewed By: JacquesLucke, LazyDodo Differential Revision: https://developer.blender.org/D9788
2020-12-02BLI: add missing constJacques Lucke
2020-09-07BLI: add comparison operators for StringRefJacques Lucke
The semantic of those is the same as for std::string_view.
2020-09-03BLI: add index_range method for StringRefJacques Lucke
2020-08-11Cleanup: spellingCampbell Barton
2020-08-10BLI: improve StringRef for C++17Jacques Lucke
Since C++17 there is also std::string_view, which is similar to StringRef. This commit does a couple of things: * New implicit conversions between StringRef and std::string_view. * Support std::string_view in blender::DefaultHash. * Support most of the methods that std::string_view has. * Add StringRef::not_found which can be used instead of -1 in some places. * Improve/fix the description at the top of BLI_string_ref.hh.
2020-08-07Cleanup: use C++ style casts in various placesJacques Lucke
2020-08-07Code Style: use "#pragma once" in source directoryJacques Lucke
This replaces header include guards with `#pragma once`. A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`), because they are used in other places. This patch has been generated by P1561 followed by `make format`. Differential Revision: https://developer.blender.org/D8466
2020-07-20Refactor: Update integer type usageJacques Lucke
This updates the usage of integer types in code I wrote according to our new style guides. Major changes: * Use signed instead of unsigned integers in many places. * C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`). * Hash values for C++ containers are 64 bit wide now (instead of 32 bit). I do hope that I broke no builds, but it is quite likely that some compiler reports slightly different errors. Please let me know when there are any errors. If the fix is small, feel free to commit it yourself. I compiled successfully on linux with gcc and on windows.
2020-07-17BLI: add StringRefNull.c_str() methodJacques Lucke
This should be used whenever you rely on the fact, that the returned pointer points to the beginning of a null-terminated array.
2020-07-03Cleanup: add const in various placesJacques Lucke
2020-07-03Cleanup: Use trailing underscore for non-public data membersJacques Lucke
This makes the code conform better with our style guide.
2020-06-30Cleanup: spellingCampbell Barton
2020-06-13Cleanup: spellingCampbell Barton
2020-06-10BLI: support constructing StringRef from start and end pointerJacques Lucke
2020-06-09BLI: rename ArrayRef to SpanJacques Lucke
This also renames `MutableArrayRef` to `MutableSpan`. The name "Span" works better, because `std::span` will provide similar functionality in C++20. Furthermore, a shorter, more concise name for a common data structure is nice.
2020-06-09BLI: put C++ data structures in "blender" namespace instead of "BLI"Jacques Lucke
We plan to use the "blender" namespace in other modules as well.
2020-06-09BLI: generally improve C++ data structuresJacques Lucke
The main focus here was to improve the docs significantly. Furthermore, I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually) faster, simpler and more customizable. I also rewrote `Stack` to make it more efficient by avoiding unnecessary copies. Thanks to everyone who helped with constructive feedback. Approved by brecht and sybren. Differential Revision: https://developer.blender.org/D7931
2020-04-25BLI: improve StringRef.copyJacques Lucke
2020-04-21BLI: Use .hh extension for C++ headers in blenlibJacques Lucke