mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Generate compile commands for clangd. (#855)
Fix all the diagnostics reported. Bug: https://github.com/ArthurSonzogni/FTXUI/issues/828
This commit is contained in:
		
				
					committed by
					
						
						ArthurSonzogni
					
				
			
			
				
	
			
			
			
						parent
						
							6a755f3760
						
					
				
				
					commit
					8a2a9b0799
				
			@@ -7,11 +7,7 @@
 | 
			
		||||
#include <chrono>      // for milliseconds, duration, steady_clock, time_point
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/event.hpp"
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
namespace animation {
 | 
			
		||||
namespace ftxui::animation {
 | 
			
		||||
// Components who haven't completed their animation can call this function to
 | 
			
		||||
// request a new frame to be drawn later.
 | 
			
		||||
//
 | 
			
		||||
@@ -26,7 +22,7 @@ using Duration = std::chrono::duration<float>;
 | 
			
		||||
// Parameter of Component::OnAnimation(param).
 | 
			
		||||
class Params {
 | 
			
		||||
 public:
 | 
			
		||||
  Params(Duration duration) : duration_(duration) {}
 | 
			
		||||
  explicit Params(Duration duration) : duration_(duration) {}
 | 
			
		||||
 | 
			
		||||
  /// The duration this animation step represents.
 | 
			
		||||
  Duration duration() const { return duration_; }
 | 
			
		||||
@@ -93,11 +89,11 @@ float BounceInOut(float p);
 | 
			
		||||
 | 
			
		||||
class Animator {
 | 
			
		||||
 public:
 | 
			
		||||
  Animator(float* from,
 | 
			
		||||
           float to = 0.f,
 | 
			
		||||
           Duration duration = std::chrono::milliseconds(250),
 | 
			
		||||
           easing::Function easing_function = easing::Linear,
 | 
			
		||||
           Duration delay = std::chrono::milliseconds(0));
 | 
			
		||||
  explicit Animator(float* from,
 | 
			
		||||
                    float to = 0.f,
 | 
			
		||||
                    Duration duration = std::chrono::milliseconds(250),
 | 
			
		||||
                    easing::Function easing_function = easing::Linear,
 | 
			
		||||
                    Duration delay = std::chrono::milliseconds(0));
 | 
			
		||||
 | 
			
		||||
  void OnAnimation(Params&);
 | 
			
		||||
 | 
			
		||||
@@ -112,7 +108,6 @@ class Animator {
 | 
			
		||||
  Duration current_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}  // namespace animation
 | 
			
		||||
}  // namespace ftxui
 | 
			
		||||
}  // namespace ftxui::animation
 | 
			
		||||
 | 
			
		||||
#endif /* end of include guard: FTXUI_ANIMATION_HPP */
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,11 @@
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
class CapturedMouseInterface {
 | 
			
		||||
 public:
 | 
			
		||||
  CapturedMouseInterface() = default;
 | 
			
		||||
  CapturedMouseInterface(const CapturedMouseInterface&) = default;
 | 
			
		||||
  CapturedMouseInterface(CapturedMouseInterface&&) = delete;
 | 
			
		||||
  CapturedMouseInterface& operator=(const CapturedMouseInterface&) = default;
 | 
			
		||||
  CapturedMouseInterface& operator=(CapturedMouseInterface&&) = delete;
 | 
			
		||||
  virtual ~CapturedMouseInterface() = default;
 | 
			
		||||
};
 | 
			
		||||
using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,9 +6,7 @@
 | 
			
		||||
 | 
			
		||||
#include <functional>  // for function
 | 
			
		||||
#include <memory>      // for make_shared, shared_ptr
 | 
			
		||||
#include <string>      // for wstring
 | 
			
		||||
#include <utility>     // for forward
 | 
			
		||||
#include <vector>      // for vector
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/component_base.hpp"  // for Component, Components
 | 
			
		||||
#include "ftxui/component/component_options.hpp"  // for ButtonOption, CheckboxOption, MenuOption
 | 
			
		||||
@@ -96,9 +94,9 @@ Component Slider(ConstStringRef label,
 | 
			
		||||
                 ConstRef<float> increment = 5.f);
 | 
			
		||||
Component Slider(ConstStringRef label,
 | 
			
		||||
                 Ref<long> value,
 | 
			
		||||
                 ConstRef<long> min = 0l,
 | 
			
		||||
                 ConstRef<long> max = 100l,
 | 
			
		||||
                 ConstRef<long> increment = 5l);
 | 
			
		||||
                 ConstRef<long> min = 0L,
 | 
			
		||||
                 ConstRef<long> max = 100L,
 | 
			
		||||
                 ConstRef<long> increment = 5L);
 | 
			
		||||
 | 
			
		||||
Component ResizableSplit(ResizableSplitOption options);
 | 
			
		||||
Component ResizableSplitLeft(Component main, Component back, int* main_size);
 | 
			
		||||
 
 | 
			
		||||
@@ -29,14 +29,16 @@ using Components = std::vector<Component>;
 | 
			
		||||
/// @ingroup component
 | 
			
		||||
class ComponentBase {
 | 
			
		||||
 public:
 | 
			
		||||
  // virtual Destructor.
 | 
			
		||||
  explicit ComponentBase(Components children)
 | 
			
		||||
      : children_(std::move(children)) {}
 | 
			
		||||
  virtual ~ComponentBase();
 | 
			
		||||
 | 
			
		||||
  ComponentBase() = default;
 | 
			
		||||
 | 
			
		||||
  // A component is not copiable.
 | 
			
		||||
  // A component is not copyable/movable.
 | 
			
		||||
  ComponentBase(const ComponentBase&) = delete;
 | 
			
		||||
  void operator=(const ComponentBase&) = delete;
 | 
			
		||||
  ComponentBase(ComponentBase&&) = delete;
 | 
			
		||||
  ComponentBase& operator=(const ComponentBase&) = delete;
 | 
			
		||||
  ComponentBase& operator=(ComponentBase&&) = delete;
 | 
			
		||||
 | 
			
		||||
  // Component hierarchy:
 | 
			
		||||
  ComponentBase* Parent() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@
 | 
			
		||||
#include <ftxui/dom/elements.hpp>  // for Element, separator
 | 
			
		||||
#include <ftxui/util/ref.hpp>      // for Ref, ConstRef, StringRef
 | 
			
		||||
#include <functional>              // for function
 | 
			
		||||
#include <optional>                // for optional
 | 
			
		||||
#include <string>                  // for string
 | 
			
		||||
 | 
			
		||||
#include "ftxui/component/component_base.hpp"  // for Component
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,7 @@
 | 
			
		||||
#define FTXUI_COMPONENT_EVENT_HPP
 | 
			
		||||
 | 
			
		||||
#include <ftxui/component/mouse.hpp>  // for Mouse
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include <string>  // for string, operator==
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <string>                     // for string, operator==
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,11 +24,14 @@ class Loop {
 | 
			
		||||
  void RunOnceBlocking();
 | 
			
		||||
  void Run();
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  // This class is non copyable.
 | 
			
		||||
  // This class is non copyable/movable.
 | 
			
		||||
  Loop(const Loop&) = default;
 | 
			
		||||
  Loop(Loop&&) = delete;
 | 
			
		||||
  Loop& operator=(Loop&&) = delete;
 | 
			
		||||
  Loop(const ScreenInteractive&) = delete;
 | 
			
		||||
  Loop& operator=(const Loop&) = delete;
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  ScreenInteractive* screen_;
 | 
			
		||||
  Component component_;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -7,12 +7,10 @@
 | 
			
		||||
#include <algorithm>           // for copy, max
 | 
			
		||||
#include <atomic>              // for atomic, __atomic_base
 | 
			
		||||
#include <condition_variable>  // for condition_variable
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <memory>   // for unique_ptr, make_unique
 | 
			
		||||
#include <mutex>    // for mutex, unique_lock
 | 
			
		||||
#include <queue>    // for queue
 | 
			
		||||
#include <utility>  // for move
 | 
			
		||||
#include <memory>              // for unique_ptr, make_unique
 | 
			
		||||
#include <mutex>               // for mutex, unique_lock
 | 
			
		||||
#include <queue>               // for queue
 | 
			
		||||
#include <utility>             // for move
 | 
			
		||||
 | 
			
		||||
namespace ftxui {
 | 
			
		||||
 | 
			
		||||
@@ -54,6 +52,10 @@ template<class T> Receiver<T> MakeReceiver();
 | 
			
		||||
template <class T>
 | 
			
		||||
class SenderImpl {
 | 
			
		||||
 public:
 | 
			
		||||
  SenderImpl(const SenderImpl&) = delete;
 | 
			
		||||
  SenderImpl(SenderImpl&&) = delete;
 | 
			
		||||
  SenderImpl& operator=(const SenderImpl&) = delete;
 | 
			
		||||
  SenderImpl& operator=(SenderImpl&&) = delete;
 | 
			
		||||
  void Send(T t) { receiver_->Receive(std::move(t)); }
 | 
			
		||||
  ~SenderImpl() { receiver_->ReleaseSender(); }
 | 
			
		||||
 | 
			
		||||
@@ -61,7 +63,7 @@ class SenderImpl {
 | 
			
		||||
 | 
			
		||||
 private:
 | 
			
		||||
  friend class ReceiverImpl<T>;
 | 
			
		||||
  SenderImpl(ReceiverImpl<T>* consumer) : receiver_(consumer) {}
 | 
			
		||||
  explicit SenderImpl(ReceiverImpl<T>* consumer) : receiver_(consumer) {}
 | 
			
		||||
  ReceiverImpl<T>* receiver_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -73,15 +75,17 @@ class ReceiverImpl {
 | 
			
		||||
    senders_++;
 | 
			
		||||
    return std::unique_ptr<SenderImpl<T>>(new SenderImpl<T>(this));
 | 
			
		||||
  }
 | 
			
		||||
  ReceiverImpl() { senders_ = 0; }
 | 
			
		||||
  ReceiverImpl() = default;
 | 
			
		||||
 | 
			
		||||
  bool Receive(T* t) {
 | 
			
		||||
    while (senders_ || !queue_.empty()) {
 | 
			
		||||
      std::unique_lock<std::mutex> lock(mutex_);
 | 
			
		||||
      if (queue_.empty())
 | 
			
		||||
      if (queue_.empty()) {
 | 
			
		||||
        notifier_.wait(lock);
 | 
			
		||||
      if (queue_.empty())
 | 
			
		||||
      }
 | 
			
		||||
      if (queue_.empty()) {
 | 
			
		||||
        continue;
 | 
			
		||||
      }
 | 
			
		||||
      *t = std::move(queue_.front());
 | 
			
		||||
      queue_.pop();
 | 
			
		||||
      return true;
 | 
			
		||||
@@ -91,8 +95,9 @@ class ReceiverImpl {
 | 
			
		||||
 | 
			
		||||
  bool ReceiveNonBlocking(T* t) {
 | 
			
		||||
    std::unique_lock<std::mutex> lock(mutex_);
 | 
			
		||||
    if (queue_.empty())
 | 
			
		||||
    if (queue_.empty()) {
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    *t = queue_.front();
 | 
			
		||||
    queue_.pop();
 | 
			
		||||
    return true;
 | 
			
		||||
@@ -127,7 +132,7 @@ class ReceiverImpl {
 | 
			
		||||
  std::mutex mutex_;
 | 
			
		||||
  std::queue<T> queue_;
 | 
			
		||||
  std::condition_variable notifier_;
 | 
			
		||||
  std::atomic<int> senders_;
 | 
			
		||||
  std::atomic<int> senders_{0};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user