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

Using ShellAnything as a shared library. #102

Open
2 of 4 tasks
end2endzone opened this issue Dec 27, 2021 · 4 comments
Open
2 of 4 tasks

Using ShellAnything as a shared library. #102

end2endzone opened this issue Dec 27, 2021 · 4 comments
Labels
code cleanup The code needs optimization enhancement New feature or request wontfix This will not be worked on

Comments

@end2endzone
Copy link
Owner

end2endzone commented Dec 27, 2021

Is your feature request related to a problem? Please describe.
To allow other software to use ShellAnything as a reusable library, the code must be simplified and cleaned up. The use of classes from standard library in header files makes the library incompatible across multiple compilers. For example, compiling the library with Visual Studio 2017 will make the library unsafe to use with Visual Studio 2019. At best, you can expect memory corruption.

Describe the solution you'd like
The following code changes must be implemented:

  • Remove usage of standard library in header files. Private implementation pattern can be used to solve this problem.
  • Replace usage of the Node class by something else. The Menu and Configuration classes use the Node class for storing children. Replace by method names such as AddMenu(), AddConfiguration() and GetChildCount().
  • Create a single class (or a Template class) that can be easily used as an implementation of a Shell Extension.
  • Convert shellanything library to a DLL with a C++ interface.

Describe alternatives you've considered
Binding for a C api could be created. This would be longer to implement.

Additional context
N/A

@end2endzone end2endzone added enhancement New feature or request code cleanup The code needs optimization labels Dec 27, 2021
end2endzone added a commit that referenced this issue Dec 28, 2021
…cts (or base types) without exposing std::vector or std::list.

Modified Configuration.h to declare class ConfigurationPtrList.
Replaced usage of Node class in ConfigManager.
For issue #102
end2endzone added a commit that referenced this issue Dec 29, 2021
Implemented IsEmpty() and empty() in ListsDeclaration.inc and ListsBody.inc.
For issue #102
end2endzone added a commit that referenced this issue Jan 1, 2022
end2endzone added a commit that referenced this issue Jan 1, 2022
end2endzone added a commit that referenced this issue Jan 1, 2022
….inc and ListsBody.inc.

Implemented clear() in ListsDeclaration.inc and ListsBody.inc for std::vector and std::list code compatibility.
For #102
@end2endzone
Copy link
Owner Author

Partially implemented features in commit e381d08.

end2endzone added a commit that referenced this issue Jan 1, 2022
Revert "Converted ShellAnything classes to use String class instead of std::string. For #102."
This reverts commit e381d08.

Revert "Updated String class."
This reverts commit 2792c81.

Revert "Created a String class to replace std::string. For #102."
This reverts commit 88722ad.

Revert "Removed unrequired includes for vector."
This reverts commit af0dd4d.

Revert "Renamed MenuPtrList2 to MenuPtrList."
This reverts commit 4d1a67c.

Revert "Modified Action.h and created ActionPtrList based on ListsDeclaration.inc and ListsBody.inc."
This reverts commit 7904429.

Revert "Deleted Node class. For issue #102."
This reverts commit 9b6d925.

Revert "Fixed memory leaks based on Node removal. For issue #102."
This reverts commit 3960a4c.

Revert "Modified Menu class to not use the Node class."
This reverts commit 60df745.

Revert "Modified Configuration class to not use the Node class."
This reverts commit 934d061.

Revert "Modified ConfigManager to always return a copy of the internal Configurations."
This reverts commit 01fc6fb.

Revert "Created ListsDeclaration.inc and ListsBody.inc to create list of objects (or base types) without exposing std::vector or std::list."
This reverts commit deccf01.
@end2endzone
Copy link
Owner Author

From commit 5b59f64 :

Restored code for String class, ListsBody.inc and ListsDeclaration.inc from the following commits:

e381d08 2792c81 88722ad af0dd4d 4d1a67c 7904429 9b6d925 3960a4c 60df745 934d061 01fc6fb deccf01

end2endzone added a commit that referenced this issue Jan 1, 2022
Removed usage of the Node class.
For #102.
@end2endzone end2endzone added the wontfix This will not be worked on label Jan 2, 2022
@end2endzone end2endzone added this to the 0.8.0 milestone Jan 2, 2022
@end2endzone end2endzone mentioned this issue Jan 2, 2022
17 tasks
@end2endzone
Copy link
Owner Author

Leaving this issue open for the moment. It may be revisited at a later time. Here are some thoughts on how to improve the previous failed design:

  • Create a String class based on code in commit 5b59f64. This class should be a transparent replacement from std::string.
    • The methods that starts with a capital letter should be discarded. These methods were created in order to comply with the coding standard.
    • Add a comment above the declaration of the class with something that says A string class that provides a safe ABI around std::string.
  • Class members that are based on std::vector, std::map or std::set should implement the Private Implementation design pattern as much as possible.
  • For classes that provide a getter of their internal list (eg: Context::GetElements()), the files ListsBody.inc and ListsDeclaration.inc should be used.

@end2endzone end2endzone changed the title Using ShellAnything as a reusable library. Using ShellAnything as a shared library. Jan 6, 2022
@end2endzone end2endzone removed this from the 0.8.0 milestone Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup The code needs optimization enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant