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

Issue 2517: add xslt render lib in cloud storage #2659

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

NikitaMsln
Copy link
Contributor

#2517
часть от пр #2588
здесь создание либы для генерации xml
добавил тесты (тест кейс взял из репы либы https://github.com/GNOME/libxslt/blob/master/tests/REC/test-12.2-1.out)
добавил структуру TXslRenderer, чтобы можно было один раз передать и распрасить xslt

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Hi! Thank you for contributing!
The tests on this PR will run after a maintainer adds an ok-to-test label to this PR manually. Thank you for your patience!

@@ -0,0 +1,43 @@
#include "xslt-render.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мы дефис в именах файлов не используем, используем _

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

return out.Str();
}

void TestAddChilds(auto&& name, auto&& value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Childs -> Children
и не вижу поводов передавать rvalue reference - почему бы не сделать так, как мы в остальном коде делаем - pass by value, а дальше std::move

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это не rvalue, а forward reference
childs на children заменил


////////////////////////////////////////////////////////////////////////////////

Y_UNIT_TEST_SUITE(XsltRenderTest)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TXsltRenderTest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

переименовал

@@ -0,0 +1,37 @@
#pragma once

#ifdef THROW
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если от этих дефайнов вообще никак невозможно избавиться, то нужно их спрятать в xml_document.cpp, чтобы они через хедер не проникали в остальной наш код

сделать TXmlNodeWrapper через какой-нибудь pimpl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну там проблема как раз в том, что есть хедеры, которые инклудят конфиги и вот это defs.h, где внутри тот же макрос THROW, поэтому раз я хочу использовать xml-document, то мне надо убрать макрос именно в хедере

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я могу конечно написать враппер для работы со всей либой cpp/xml/document, но звучит хуже, чем эта кучка ифдефов

xmlCleanupGlobals();
xmlCleanupParser();
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пустой строки не хватает после };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавил


#include "xml-document.h"

#include <contrib/libs/libxml/include/libxml/globals.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

опять же лучше сделать через pimpl, чтоб этих жутких хедеров не было в наших хедерах - чтоб они в остальной код через include-ы не заезжали

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сделал

@yegorskii yegorskii added the ok-to-test Label to approve test launch for external members label Dec 19, 2024
@github-actions github-actions bot removed the ok-to-test Label to approve test launch for external members label Dec 19, 2024
Copy link
Contributor

Note

This is an automated comment that will be appended during run.

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit a359923.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
6168 6168 0 0 0 0

class TXmlNodeWrapper final
{
public:
enum ESource
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum class?


explicit TXmlNodeWrapper(std::unique_ptr<TData> data);

std::unique_ptr<TData> Data = nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

явно инициализировать кажется нет смысла

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants