Class: OpenCV::Cv::String
- Inherits:
-
Object
- Object
- OpenCV::Cv::String
- Extended by:
- FFI::DataConverter
- Defined in:
- lib/ruby/ropencv/ropencv_ruby.rb,
lib/ruby/ropencv/ropencv_types.rb
Instance Attribute Summary collapse
- #__obj_ptr__ ⇒ Object readonly private
Class Method Summary collapse
-
.from_native(ptr, context) ⇒ Object
private
can be overwritten by the user.
- .new(*args) ⇒ Object
- .rbind_from_native(ptr, context) ⇒ Object private
- .rbind_to_native(obj, context) ⇒ Object private
-
.to_native(obj, context) ⇒ Object
private
can be overwritten by the user.
Instance Method Summary collapse
-
#[](idx) ⇒ Object
wrapper for char cv::String::operator[](size_t idx).
-
#__owner__? ⇒ Boolean
private
returns true if the underlying pointer is owner of the real object.
-
#c_str ⇒ Object
wrapper for const_c_string cv::String::c_str().
-
#clear ⇒ Object
wrapper for void cv::String::clear().
-
#compare(str) ⇒ Object
wrapper for int cv::String::compare(const cv::String str).
-
#empty ⇒ Object
wrapper for bool cv::String::empty().
-
#initialize(ptr) ⇒ String
constructor
private
A new instance of String.
-
#length ⇒ Object
wrapper for size_t cv::String::length().
-
#size ⇒ Object
methods wrapper for size_t cv::String::size().
-
#swap(str) ⇒ Object
wrapper for void cv::String::swap(cv::String str).
- #to_s ⇒ Object
Constructor Details
#initialize(ptr) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of String.
2731 2732 2733 2734 2735 2736 2737 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2731 def initialize(ptr) @__obj_ptr__ = if ptr.is_a? StringStruct ptr else StringStruct.new(FFI::AutoPointer.new(ptr,StringStruct.method(:release))) end end |
Instance Attribute Details
#__obj_ptr__ ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2728 2729 2730 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2728 def __obj_ptr__ @__obj_ptr__ end |
Class Method Details
.from_native(ptr, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
can be overwritten by the user
2723 2724 2725 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2723 def self.from_native(ptr,context) rbind_from_native(ptr,context) end |
.new(*args) ⇒ Object
2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2654 def self.new(*args) if args.first.is_a?(FFI::Pointer) || args.first.is_a?(StringStruct) raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1 return super(args.first) end # wrapper for cv::String::String() @@cv_string_string_defaults0 ||= [] if(args.size >= 0 && args.size <= 0) args.size.upto(-1) do |i| args[i] = @@cv_string_string_defaults0[i] end begin return Rbind::cv_string_string(*args) rescue TypeError => e @error = e end end # wrapper for cv::String::String(c_string str, size_t length) @@cv_string_string2_defaults1 ||= [nil, nil] if(args.size >= 2 && args.size <= 2) args.size.upto(1) do |i| args[i] = @@cv_string_string2_defaults1[i] end begin return Rbind::cv_string_string2(*args) rescue TypeError => e @error = e end end # wrapper for cv::String::String(const cv::String other) @@cv_string_string3_defaults2 ||= [nil] if(args.size >= 1 && args.size <= 1) args.size.upto(0) do |i| args[i] = @@cv_string_string3_defaults2[i] end begin return Rbind::cv_string_string3(*args) rescue TypeError => e @error = e end end raise ArgumentError, "no constructor for #{self}(#{args.inspect})" end |
.rbind_from_native(ptr, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2711 2712 2713 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2711 def self.rbind_from_native(ptr,context) String.new(ptr) end |
.rbind_to_native(obj, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2702 2703 2704 2705 2706 2707 2708 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2702 def self.rbind_to_native(obj,context) if obj.is_a? String obj.__obj_ptr__ else raise TypeError, "expected kind of #{name}, was #{obj.class}" end end |
.to_native(obj, context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
can be overwritten by the user
2717 2718 2719 2720 2721 2722 2723 2724 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2717 def self.to_native(obj,context) if obj.is_a? ::String str = obj.to_str OpenCV::Cv::String.new(str,str.length).__obj_ptr__ else rbind_to_native(obj,context) end end |
Instance Method Details
#[](idx) ⇒ Object
wrapper for char cv::String::operator[](size_t idx)
2766 2767 2768 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2766 def [](idx) Rbind::cv_string_operator_array( self, idx) end |
#__owner__? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
returns true if the underlying pointer is owner of the real object
2742 2743 2744 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2742 def __owner__? @__obj_ptr__[:bowner] end |
#c_str ⇒ Object
wrapper for const_c_string cv::String::c_str()
2771 2772 2773 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2771 def c_str() Rbind::cv_stringc_str( self) end |
#clear ⇒ Object
wrapper for void cv::String::clear()
2781 2782 2783 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2781 def clear() Rbind::cv_string_clear( self) end |
#compare(str) ⇒ Object
wrapper for int cv::String::compare(const cv::String str)
2786 2787 2788 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2786 def compare(str) Rbind::cv_string_compare( self, str) end |
#empty ⇒ Object
wrapper for bool cv::String::empty()
2776 2777 2778 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2776 def empty() Rbind::cv_string_empty( self) end |
#length ⇒ Object
wrapper for size_t cv::String::length()
2761 2762 2763 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2761 def length() Rbind::cv_string_length( self) end |
#size ⇒ Object
methods wrapper for size_t cv::String::size()
2756 2757 2758 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2756 def size() Rbind::cv_string_size( self) end |
#swap(str) ⇒ Object
wrapper for void cv::String::swap(cv::String str)
2791 2792 2793 |
# File 'lib/ruby/ropencv/ropencv_types.rb', line 2791 def swap(str) Rbind::cv_string_swap( self, str) end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/ruby/ropencv/ropencv_ruby.rb', line 20 def to_s c_str end |