@@ -113,6 +113,10 @@ cdef extern from "pkgcraft.h":
113113 cdef struct Config:
114114 pass
115115
116+ # Opaque wrapper for pkgcraft::dep::cpv::Cpn<String> objects.
117+ cdef struct Cpn:
118+ pass
119+
116120 # Opaque wrapper for pkgcraft::dep::cpv::Cpv<String> objects.
117121 cdef struct Cpv:
118122 pass
@@ -333,6 +337,71 @@ cdef extern from "pkgcraft.h":
333337 # The config argument must be a non-null Config pointer.
334338 RepoSet * pkgcraft_config_repos_set(Config * c, const RepoFormat * format)
335339
340+ # Get the category of a Cpn object.
341+ #
342+ # # Safety
343+ # The argument must be a non-null Cpn pointer.
344+ char * pkgcraft_cpn_category(Cpn * c)
345+
346+ # Compare two Cpns returning -1, 0, or 1 if the first is less than, equal to, or
347+ # greater than the second, respectively.
348+ #
349+ # # Safety
350+ # The arguments must be non-null Cpn pointers.
351+ int pkgcraft_cpn_cmp(Cpn * c1, Cpn * c2)
352+
353+ # Free a Cpn.
354+ #
355+ # # Safety
356+ # The argument must be a Cpn pointer or NULL.
357+ void pkgcraft_cpn_free(Cpn * c)
358+
359+ # Return the hash value for a Cpn object.
360+ #
361+ # # Safety
362+ # The argument must be a non-null Cpn pointer.
363+ uint64_t pkgcraft_cpn_hash(Cpn * c)
364+
365+ # Parse a string into a Cpn object.
366+ #
367+ # Returns NULL on error.
368+ #
369+ # # Safety
370+ # The argument should be a UTF-8 string.
371+ Cpn * pkgcraft_cpn_new(const char * s)
372+
373+ # Get the package name of a Cpn object.
374+ #
375+ # # Safety
376+ # The argument must be a non-null Cpn pointer.
377+ char * pkgcraft_cpn_package(Cpn * c)
378+
379+ # Determine if a string is a valid package Cpn.
380+ #
381+ # Returns NULL on error.
382+ #
383+ # # Safety
384+ # The argument should point to a UTF-8 string.
385+ const char * pkgcraft_cpn_parse(const char * s)
386+
387+ # Return the restriction for a Cpn object.
388+ #
389+ # # Safety
390+ # The argument must be a non-null Cpn pointer.
391+ Restrict * pkgcraft_cpn_restrict(Cpn * c)
392+
393+ # Determine if a restriction matches a Cpn object.
394+ #
395+ # # Safety
396+ # The arguments must be valid Restrict and Cpn pointers.
397+ bool pkgcraft_cpn_restrict_matches(Cpn * c, Restrict * r)
398+
399+ # Return the string for a Cpn object.
400+ #
401+ # # Safety
402+ # The argument must be a non-null Cpn pointer.
403+ char * pkgcraft_cpn_str(Cpn * c)
404+
336405 # Get the category of a Cpv object.
337406 #
338407 # # Safety
@@ -346,11 +415,11 @@ cdef extern from "pkgcraft.h":
346415 # The arguments must be non-null Cpv pointers.
347416 int pkgcraft_cpv_cmp(Cpv * c1, Cpv * c2)
348417
349- # Get the category and package of a Cpv object.
418+ # Get the Cpn of a Cpv object.
350419 #
351420 # # Safety
352421 # The argument must be a non-null Cpv pointer.
353- char * pkgcraft_cpv_cpn(Cpv * c)
422+ Cpn * pkgcraft_cpv_cpn(Cpv * c)
354423
355424 # Free a Cpv.
356425 #
@@ -376,7 +445,7 @@ cdef extern from "pkgcraft.h":
376445 # The arguments must be non-null Cpv and Dep pointers.
377446 bool pkgcraft_cpv_intersects_dep(Cpv * c, Dep * d)
378447
379- # Parse a CPV string into a Cpv object.
448+ # Parse a string into a Cpv object.
380449 #
381450 # Returns NULL on error.
382451 #
@@ -496,12 +565,11 @@ cdef extern from "pkgcraft.h":
496565 # The arguments must be non-null Dep pointers.
497566 int pkgcraft_dep_cmp(Dep * d1, Dep * d2)
498567
499- # Get the category and package of a package dependency.
500- # For example, the package dependency "=cat/pkg-1-r2" returns "cat/pkg".
568+ # Get the Cpn of a package dependency.
501569 #
502570 # # Safety
503571 # The argument must be a non-null Dep pointer.
504- char * pkgcraft_dep_cpn(Dep * d)
572+ Cpn * pkgcraft_dep_cpn(Dep * d)
505573
506574 # Get the category, package, and version of a package dependency.
507575 # For example, the package dependency "=cat/pkg-1-r2" returns "cat/pkg-1-r2".
@@ -554,14 +622,6 @@ cdef extern from "pkgcraft.h":
554622 Dep * pkgcraft_dep_new(const char * s,
555623 const Eapi * eapi)
556624
557- # Parse a string into an unversioned package dependency.
558- #
559- # Returns NULL on error.
560- #
561- # # Safety
562- # The argument must be a UTF-8 string.
563- Dep * pkgcraft_dep_new_cpn(const char * s)
564-
565625 # Get the package and revision of a package dependency.
566626 # For example, the package dependency "=cat/pkg-1-r2" returns "pkg-1".
567627 #
0 commit comments